From e38f14b40dc8cbb9079d8f8ebc3fb43b82ace82c Mon Sep 17 00:00:00 2001 From: wisonic-s Date: Thu, 18 Jan 2024 18:53:22 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=A7=86=E5=9B=BE-=E6=B0=B4=E6=B3=A2?= =?UTF-8?q?=E5=9B=BE):=20=E6=95=B0=E5=80=BC=E8=BF=87=E5=A4=A7=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/js/panel/charts/liquid/liquid.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/liquid/liquid.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/liquid/liquid.ts index c9b9143698..766ea58a48 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/liquid/liquid.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/liquid/liquid.ts @@ -112,6 +112,14 @@ export class Liquid extends G2PlotChartView { protected configLabel(chart: Chart, options: LiquidOptions): LiquidOptions { const customAttr = parseJson(chart.customAttr) + const originVal = options.percent + // 数值过大视图会异常,大于 1 无意义 + if (originVal > 1) { + options = { + ...options, + percent: 1 + } + } if (!customAttr.label?.show) { return { ...options, @@ -130,9 +138,8 @@ export class Liquid extends G2PlotChartView { fontSize: label.fontSize.toString() + 'px', color: label.color }, - formatter: function (v) { - const value = v.percent - return valueFormatter(value, labelFormatter) + formatter: () => { + return valueFormatter(originVal, labelFormatter) } } }