budget-go/frontend/js/chart/savingAccount.js
2025-03-25 23:02:31 +01:00

30 lines
620 B
JavaScript

const compute = (accounts) => {
const labels = []
const released = {
label: 'Débloqué',
borderColor: 'rgb(105, 167, 86)',
backgroundColor: 'rgb(121, 199, 83)',
fill: true,
data: [],
}
const blocked = {
label: 'Bloqué',
borderColor: 'rgb(217, 139, 102)',
backgroundColor: 'rgb(255, 209, 130)',
fill: true,
data: [],
}
accounts.forEach((value) => {
labels.push(value.label)
blocked.data.push(value.blocked_amount)
released.data.push(value.released_amount)
})
return {
labels: labels,
datasets: [blocked, released],
}
}
export { compute }