fix chart to sum by day

This commit is contained in:
2022-11-11 19:34:23 -05:00
parent 8231683958
commit 2191e7f4f4
16 changed files with 74 additions and 180 deletions

View File

@ -11,22 +11,23 @@ export default {
data: {
datasets: [{
label: el.dataset.label,
data: data.map(({ date, count, labels }) => ({
labels,
data: data.map(({ date, count, label }) => ({
label,
x: date,
y: count
})),
backgroundColor: el.dataset.color,
backgroundColor: `${el.dataset.color}77`,
borderColor: el.dataset.color,
fill: true,
borderWidth: 4
borderWidth: 3,
pointBorderWidth: 1
}]
},
options: {
elements: {
point: {
radius: 7,
hoverRadius: 10
radius: 9,
hoverRadius: 12
}
},
plugins: {
@ -39,7 +40,8 @@ export default {
tooltip: {
displayColors: false,
callbacks: {
label: ({ raw: { labels } }) => labels
title: (contexts) => contexts.map(({ raw: { x } }) => Intl.DateTimeFormat([], { timeZone: 'Etc/UTC', dateStyle: 'short' }).format(new Date(x))),
label: ({ raw: { label } }) => label
}
}
},