mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
- Mantine charts tooltip can't handle '.' character.
(cherry picked from commit d7d908b74f
)
Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
parent
5b1e15ed30
commit
24d5730c54
@ -32,13 +32,18 @@ function BomPieChart({
|
|||||||
}) {
|
}) {
|
||||||
// Construct donut data
|
// Construct donut data
|
||||||
const maxPricing = useMemo(() => {
|
const maxPricing = useMemo(() => {
|
||||||
return data.map((entry, index) => {
|
return (
|
||||||
return {
|
data
|
||||||
name: entry.name,
|
?.filter((el: any) => !!el.total_price_max)
|
||||||
value: entry.total_price_max,
|
.map((entry, index) => {
|
||||||
color: CHART_COLORS[index % CHART_COLORS.length] + '.5'
|
return {
|
||||||
};
|
// Note: Replace '.' in name to avoid issues with tooltip
|
||||||
});
|
name: entry?.name?.replace('.', '') ?? '',
|
||||||
|
value: entry?.total_price_max,
|
||||||
|
color: CHART_COLORS[index % CHART_COLORS.length] + '.5'
|
||||||
|
};
|
||||||
|
}) ?? []
|
||||||
|
);
|
||||||
}, [data]);
|
}, [data]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -170,8 +175,8 @@ export default function BomPricingPanel({
|
|||||||
const [chartType, setChartType] = useState<string>('pie');
|
const [chartType, setChartType] = useState<string>('pie');
|
||||||
|
|
||||||
const hasData: boolean = useMemo(() => {
|
const hasData: boolean = useMemo(() => {
|
||||||
return !table.isLoading && bomPricingData.length > 0;
|
return !table.isLoading && bomPricingData && bomPricingData.length > 0;
|
||||||
}, [table.isLoading, bomPricingData.length]);
|
}, [table.isLoading, bomPricingData]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack gap="xs">
|
<Stack gap="xs">
|
||||||
|
Loading…
Reference in New Issue
Block a user