mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 06:46:38 +00:00
fix(data-vi): tooltip bug of pie chart (#3745)
This commit is contained in:
parent
3b619682ee
commit
3942b7cb94
@ -1,6 +1,6 @@
|
||||
import { G2PlotChart } from './g2plot';
|
||||
import { Pie as G2Pie } from '@ant-design/plots';
|
||||
import { ChartType } from '../chart';
|
||||
import { ChartType, RenderProps } from '../chart';
|
||||
|
||||
export class Pie extends G2PlotChart {
|
||||
constructor() {
|
||||
@ -30,4 +30,19 @@ export class Pie extends G2PlotChart {
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
getProps({ data, general, advanced, fieldProps }: RenderProps) {
|
||||
const props = super.getProps({ data, general, advanced, fieldProps });
|
||||
return {
|
||||
...props,
|
||||
tooltip: (d, index: number, data, column: any) => {
|
||||
const field = column.y0.field;
|
||||
const props = fieldProps[field];
|
||||
const name = props?.label || field;
|
||||
const transformer = props?.transformer;
|
||||
const value = column.y0.value[index];
|
||||
return { name, value: transformer ? transformer(value) : value };
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user