feat: 仪表盘阈值

This commit is contained in:
junjun 2022-03-08 16:37:37 +08:00
parent 5be238fc4f
commit c87f3eadb5
2 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,6 @@
import { componentStyle } from '../common/common'
import { hexColorToRGBA } from '@/views/chart/chart/util'
import { DEFAULT_THRESHOLD } from '@/views/chart/chart/chart'
export function baseGaugeOption(chart_option, chart) {
// 处理shape attr
@ -53,7 +54,7 @@ export function baseGaugeOption(chart_option, chart) {
if (chart.senior) {
const range = []
const senior = JSON.parse(chart.senior)
const threshold = JSON.parse(JSON.stringify(senior.threshold))
const threshold = JSON.parse(JSON.stringify(senior.threshold ? senior.threshold : DEFAULT_THRESHOLD))
if (threshold.gaugeThreshold && threshold.gaugeThreshold !== '') {
const arr = threshold.gaugeThreshold.split(',')
for (let i = 0; i < arr.length; i++) {

View File

@ -1,6 +1,6 @@
import { getPadding, getTheme } from '@/views/chart/chart/common/common_antv'
import { Gauge } from '@antv/g2plot'
import { DEFAULT_SIZE } from '@/views/chart/chart/chart'
import { DEFAULT_SIZE, DEFAULT_THRESHOLD } from '@/views/chart/chart/chart'
export function baseGaugeOptionAntV(plot, container, chart, action) {
let max, labelContent, startAngel, endAngel
@ -42,7 +42,7 @@ export function baseGaugeOptionAntV(plot, container, chart, action) {
if (chart.senior) {
const senior = JSON.parse(chart.senior)
const threshold = JSON.parse(JSON.stringify(senior.threshold))
const threshold = JSON.parse(JSON.stringify(senior.threshold ? senior.threshold : DEFAULT_THRESHOLD))
if (threshold.gaugeThreshold && threshold.gaugeThreshold !== '') {
hasThreshold = true
const arr = threshold.gaugeThreshold.split(',')