Upgraded Chart.js to v4. Updated charts.

This commit is contained in:
Mike Cao 2023-03-14 22:37:50 -07:00
parent 3823705fc6
commit c1d3e9ec67
11 changed files with 113 additions and 174 deletions

View file

@ -181,18 +181,18 @@ export function getDateArray(data, startDate, endDate, unit) {
const n = diff(endDate, startDate) + 1;
function findData(t) {
const x = data.find(e => {
return normalize(getDateFromString(e.t)).getTime() === t.getTime();
const d = data.find(({ x }) => {
return normalize(getDateFromString(x)).getTime() === t.getTime();
});
return x?.y || 0;
return d?.y || 0;
}
for (let i = 0; i < n; i++) {
const t = normalize(add(startDate, i));
const y = findData(t);
arr.push({ ...data[i], t, y });
arr.push({ x: t, y });
}
return arr;