From c87f3eadb50bdf28d9622d1dc9e4aa56a7add29c Mon Sep 17 00:00:00 2001 From: junjun Date: Tue, 8 Mar 2022 16:37:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BB=AA=E8=A1=A8=E7=9B=98=E9=98=88?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/chart/chart/gauge/gauge.js | 3 ++- frontend/src/views/chart/chart/gauge/gauge_antv.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/chart/chart/gauge/gauge.js b/frontend/src/views/chart/chart/gauge/gauge.js index 654088b8f2..c58cfeac61 100644 --- a/frontend/src/views/chart/chart/gauge/gauge.js +++ b/frontend/src/views/chart/chart/gauge/gauge.js @@ -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++) { diff --git a/frontend/src/views/chart/chart/gauge/gauge_antv.js b/frontend/src/views/chart/chart/gauge/gauge_antv.js index a927c859ec..000219141b 100644 --- a/frontend/src/views/chart/chart/gauge/gauge_antv.js +++ b/frontend/src/views/chart/chart/gauge/gauge_antv.js @@ -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(',')