30 lines
603 B
JavaScript
30 lines
603 B
JavaScript
$(document).ready(function() {
|
|
fetch('/api/stats/graph')
|
|
.then(response => response.json())
|
|
.then(response => {
|
|
console.log(response.datasets);
|
|
new Chart(
|
|
document.getElementById('graph_canvas'),
|
|
{
|
|
type: 'line',
|
|
data: {
|
|
datasets: response.datasets
|
|
},
|
|
options: {
|
|
scales: {
|
|
x: {
|
|
type: 'time'
|
|
}
|
|
},
|
|
parsing: {
|
|
xAxisKey: 'date',
|
|
yAxisKey: 'score'
|
|
}
|
|
}
|
|
|
|
}
|
|
);
|
|
});
|
|
|
|
});
|