update chart

This commit is contained in:
2021-10-16 21:23:03 +01:00
parent 11d12b9ac3
commit f9b777d061
4 changed files with 47 additions and 8 deletions

View File

@ -9,14 +9,29 @@ const alcoholAbuseChart = new Chart(alcoholAbuseCanvas, {
labels: alcoholDeathPercent.map(function(a) { return a.year }),
datasets: [{
label: 'Deaths by Alcohol Abuse',
data: alcoholDeathPercent.map(function(a) { return a.val }),
data: alcoholDeathPercent.map(function(a) { return a.val * 100 }),
fill: true,
backgroundColor: 'rgb(249, 98, 200)'
}, {
label: 'Prevalence of Alcohol Abuse',
data: alcoholPrevalencePercent.map(function(a) { return a.val }),
data: alcoholPrevalencePercent.map(function(a) { return a.val * 100 }),
borderColor: 'rgb(97, 152, 250)'
}]
},
options: {
aspectRatio: 1,
scales: {
y: {
type: 'linear',
beginAtZero: true,
max: 2,
ticks: {
callback: function(value, index, values) {
return value + '%';
}
}
}
}
}
});