fix(data-vi): issue where data transformations do not work on tooltip in dual-axies charts (#5649)

This commit is contained in:
YANG QIA 2024-11-14 16:53:50 +08:00 committed by GitHub
parent c607e886bc
commit b1fcfe0b21
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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;