Updated tracker and collect.

This commit is contained in:
Mike Cao 2023-03-26 04:15:08 -07:00
parent 43ef6884df
commit cdacb640c6
12 changed files with 234 additions and 463 deletions

View file

@ -52,7 +52,7 @@ export default function BarChart({
millisecond: 'T',
second: 'pp',
minute: 'p',
hour: 'h aaa',
hour: 'h:mm aaa - PP',
day: 'PPPP',
week: 'PPPP',
month: 'LLLL yyyy',
@ -135,15 +135,13 @@ export default function BarChart({
},
},
};
}, [animationDuration, renderTooltip, stacked, colors]);
}, [animationDuration, renderTooltip, stacked, colors, unit]);
const createChart = () => {
Chart.defaults.font.family = 'Inter';
const options = getOptions();
onCreate(options);
chart.current = new Chart(canvas.current, {
type: 'bar',
data: {
@ -151,6 +149,8 @@ export default function BarChart({
},
options,
});
onCreate(chart.current);
};
const updateChart = () => {
@ -158,9 +158,11 @@ export default function BarChart({
chart.current.options = getOptions();
onUpdate(chart.current);
chart.current.data.datasets = datasets;
chart.current.update();
onUpdate(chart.current);
};
useEffect(() => {