fix(data-vi): the custom tooltip for the pie chart is not working (#4392)

This commit is contained in:
YANG QIA 2024-05-18 22:06:06 +08:00 committed by GitHub
parent 49d0082b16
commit 299c5a14cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -57,9 +57,7 @@ export class Pie extends G2PlotChart {
}; };
} }
const props = super.getProps({ data, general, advanced, fieldProps }); const props = super.getProps({ data, general, advanced, fieldProps });
return { const defaultTooltip = {
...props,
tooltip: {
items: [ items: [
(data: any) => { (data: any) => {
const { [general.colorField]: color, [angleField]: angle } = data; const { [general.colorField]: color, [angleField]: angle } = data;
@ -68,7 +66,10 @@ export class Pie extends G2PlotChart {
return { name, value: transformer ? transformer(angle) : angle }; return { name, value: transformer ? transformer(angle) : angle };
}, },
], ],
}, };
return {
...props,
tooltip: advanced.tooltip || defaultTooltip,
}; };
} }
} }