From b1fcfe0b217ee4a1cd227c7f73d9fa0a6b49e2de Mon Sep 17 00:00:00 2001 From: YANG QIA <2013xile@gmail.com> Date: Thu, 14 Nov 2024 16:53:50 +0800 Subject: [PATCH] fix(data-vi): issue where data transformations do not work on tooltip in dual-axies charts (#5649) --- .../src/client/chart/g2plot/dualAxes.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/plugins/@nocobase/plugin-data-visualization/src/client/chart/g2plot/dualAxes.ts b/packages/plugins/@nocobase/plugin-data-visualization/src/client/chart/g2plot/dualAxes.ts index a538440bfc..de580001fe 100644 --- a/packages/plugins/@nocobase/plugin-data-visualization/src/client/chart/g2plot/dualAxes.ts +++ b/packages/plugins/@nocobase/plugin-data-visualization/src/client/chart/g2plot/dualAxes.ts @@ -84,6 +84,20 @@ export class DualAxes extends G2PlotChart { return { type: 'line', yField, + tooltip: { + items: [ + (data: any) => { + const { [yField]: y } = data; + const yFieldProps = fieldProps[yField]; + const name = yFieldProps?.label || yField; + const value = yFieldProps?.transformer ? yFieldProps.transformer(y) : y; + return { + name, + value, + }; + }, + ], + }, colorField: () => { const props = fieldProps[yField]; return props?.label || yField;