mirror of
https://gitee.com/nocobase/nocobase.git
synced 2024-12-04 21:28:34 +08: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 { G2PlotChart } from './g2plot';
|
||||||
import { Pie as G2Pie } from '@ant-design/plots';
|
import { Pie as G2Pie } from '@ant-design/plots';
|
||||||
import { ChartType } from '../chart';
|
import { ChartType, RenderProps } from '../chart';
|
||||||
|
|
||||||
export class Pie extends G2PlotChart {
|
export class Pie extends G2PlotChart {
|
||||||
constructor() {
|
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