Files
bookmeterplus/src/chart.js
2026-01-01 10:34:28 +01:00

35 lines
803 B
JavaScript
Executable File

import Chart from 'chart.js/auto'
const data = [
{year: 2009, count: 10},
{year: 2010, count: NaN},
{year: 2011, count: 20},
{year: 2012, count: 15},
{year: 2013, count: 25},
{year: 2014, count: 22},
{year: 2015, count: 30},
{year: 2016, count: 28},
];
// linechart.data.labels.push(label);
// linechart.data.datasets.forEach((dataset) => {
// dataset.data.push(newData);
// });
// linechart.update();
window.linechart = new Chart(
document.getElementById('acquisitions'),
{
type: 'bar',
data: {
labels: data.map(row => row.year),
datasets: [
{
label: 'Acquisitions by year',
data: data.map(row => row.count)
}
]
}
}
);