From 24ba27fad7f84ddaf5fc9100d6baaca284ea0d97 Mon Sep 17 00:00:00 2001 From: jianneng-fit2cloud Date: Tue, 24 Jun 2025 17:58:27 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8):=20=E5=AD=90=E5=BC=B9?= =?UTF-8?q?=E5=9B=BE=E6=8F=90=E7=A4=BA=E4=B8=AD=EF=BC=8C=E5=AE=9E=E9=99=85?= =?UTF-8?q?=E5=80=BC=E4=B8=8E=E7=9B=AE=E6=A0=87=E5=80=BC=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98=20#16308?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/panel/charts/bar/bullet-graph.ts | 32 +++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/bar/bullet-graph.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/bar/bullet-graph.ts index e9a77fe8fe..623f7d8ed9 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/bar/bullet-graph.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/bar/bullet-graph.ts @@ -358,21 +358,35 @@ export class BulletGraph extends G2PlotChartView { const result = [] const data = options.data.find(item => item.title === originalItems[0].title) - Object.keys(formatterMap).forEach(key => { + Object.keys(formatterMap).forEach((key, index) => { if (key === '记录数*') return const formatter = formatterMap[key] if (formatter) { if (key !== 'ranges') { + let name = '' let value = 0 - if (chart.yAxis[0].id === chart.yAxisExt[0].id) { - value = valueFormatter(parseFloat(data['target'] as string), formatter.formatterCfg) - } else { - value = valueFormatter(parseFloat(data[key] as string), formatter.formatterCfg) + let color: string | Array = [] + let tFormatter = chart.yAxis[1] + if (index === 0) { + tFormatter = chart.yAxis[0] + value = valueFormatter( + parseFloat(data['measures'] as string), + formatter.formatterCfg + ) + color = bullet.bar['measures'].fill } - const name = isEmpty(formatter.chartShowName) - ? formatter.name - : formatter.chartShowName - result.push({ ...originalItems[0], color: bullet.bar[key].fill, name, value }) + if (index === 1) { + tFormatter = chart.yAxisExt[0] + value = valueFormatter(parseFloat(data['target'] as string), formatter.formatterCfg) + color = bullet.bar['target'].fill + } + name = isEmpty(tFormatter.chartShowName) ? tFormatter.name : tFormatter.chartShowName + result.push({ + color, + name, + value + }) + result.reverse() } else { const ranges = data.ranges const isDynamic = bullet.bar.ranges.showType === 'dynamic'