This commit is contained in:
Francis Cao 2024-04-02 00:19:26 -07:00
commit bc5e85c838
3 changed files with 5 additions and 4 deletions

View File

@ -81,6 +81,7 @@ export function Chart({
const updateChart = (data: any) => {
chart.current.data.datasets.forEach((dataset: { data: any }, index: string | number) => {
dataset.data = data?.datasets[index]?.data;
chart.current.legend.legendItems[index].text = data?.datasets[index].label;
});
chart.current.options = options;
@ -88,9 +89,9 @@ export function Chart({
// Allow config changes before update
onUpdate?.(chart.current);
chart.current.update(updateMode);
setLegendItems(chart.current.legend.legendItems);
chart.current.update(updateMode);
};
useEffect(() => {

View File

@ -38,7 +38,7 @@ export function PageviewsChart({ data, unit, isLoading, ...props }: PageviewsCha
},
],
};
}, [data]);
}, [data, locale]);
return (
<BarChart

View File

@ -63,6 +63,7 @@
title: encode(title),
url: encode(currentUrl),
referrer: encode(currentRef),
tag: tag ? tag : undefined,
});
/* Event handlers */
@ -217,7 +218,6 @@
...getPayload(),
name: obj,
data: typeof data === 'object' ? data : undefined,
tag,
});
} else if (typeof obj === 'object') {
return send(obj);