提交 c87f3ead authored 作者: junjun's avatar junjun

feat: 仪表盘阈值

上级 5be238fc
import { componentStyle } from '../common/common' import { componentStyle } from '../common/common'
import { hexColorToRGBA } from '@/views/chart/chart/util' import { hexColorToRGBA } from '@/views/chart/chart/util'
import { DEFAULT_THRESHOLD } from '@/views/chart/chart/chart'
export function baseGaugeOption(chart_option, chart) { export function baseGaugeOption(chart_option, chart) {
// 处理shape attr // 处理shape attr
...@@ -53,7 +54,7 @@ export function baseGaugeOption(chart_option, chart) { ...@@ -53,7 +54,7 @@ export function baseGaugeOption(chart_option, chart) {
if (chart.senior) { if (chart.senior) {
const range = [] const range = []
const senior = JSON.parse(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 !== '') { if (threshold.gaugeThreshold && threshold.gaugeThreshold !== '') {
const arr = threshold.gaugeThreshold.split(',') const arr = threshold.gaugeThreshold.split(',')
for (let i = 0; i < arr.length; i++) { for (let i = 0; i < arr.length; i++) {
......
import { getPadding, getTheme } from '@/views/chart/chart/common/common_antv' import { getPadding, getTheme } from '@/views/chart/chart/common/common_antv'
import { Gauge } from '@antv/g2plot' 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) { export function baseGaugeOptionAntV(plot, container, chart, action) {
let max, labelContent, startAngel, endAngel let max, labelContent, startAngel, endAngel
...@@ -42,7 +42,7 @@ export function baseGaugeOptionAntV(plot, container, chart, action) { ...@@ -42,7 +42,7 @@ export function baseGaugeOptionAntV(plot, container, chart, action) {
if (chart.senior) { if (chart.senior) {
const senior = JSON.parse(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 !== '') { if (threshold.gaugeThreshold && threshold.gaugeThreshold !== '') {
hasThreshold = true hasThreshold = true
const arr = threshold.gaugeThreshold.split(',') const arr = threshold.gaugeThreshold.split(',')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论