2020-08-30 13:57:02 +09:00
|
|
|
import Chart from 'chart.js';
|
2019-03-05 00:25:13 +09:00
|
|
|
|
2020-06-06 16:14:11 +09:00
|
|
|
const graph = document.getElementById('global-count-graph') as HTMLCanvasElement;
|
2020-06-06 19:12:00 +09:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
2020-06-06 16:14:11 +09:00
|
|
|
const labels = JSON.parse(document.getElementById('global-count-labels')!.textContent as string);
|
2020-06-06 19:12:00 +09:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
2020-06-06 16:14:11 +09:00
|
|
|
const data = JSON.parse(document.getElementById('global-count-data')!.textContent as string);
|
2019-03-05 00:25:13 +09:00
|
|
|
|
2020-06-06 19:12:00 +09:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
2020-06-06 16:14:11 +09:00
|
|
|
new Chart(graph.getContext('2d')!, {
|
2019-03-05 00:25:13 +09:00
|
|
|
type: 'bar',
|
|
|
|
data: {
|
|
|
|
labels,
|
2020-06-06 18:01:56 +09:00
|
|
|
datasets: [
|
|
|
|
{
|
|
|
|
data,
|
|
|
|
backgroundColor: 'rgba(0, 0, 0, .1)',
|
|
|
|
borderColor: 'rgba(0, 0, 0, .25)',
|
|
|
|
borderWidth: 1,
|
|
|
|
},
|
|
|
|
],
|
2019-03-05 00:25:13 +09:00
|
|
|
},
|
|
|
|
options: {
|
|
|
|
maintainAspectRatio: false,
|
|
|
|
legend: {
|
2020-06-06 18:01:56 +09:00
|
|
|
display: false,
|
2019-03-05 00:25:13 +09:00
|
|
|
},
|
|
|
|
elements: {
|
2020-06-06 18:01:56 +09:00
|
|
|
line: {},
|
2019-03-05 00:25:13 +09:00
|
|
|
},
|
|
|
|
scales: {
|
2020-06-06 18:01:56 +09:00
|
|
|
xAxes: [
|
|
|
|
{
|
|
|
|
display: false,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
yAxes: [
|
|
|
|
{
|
|
|
|
display: false,
|
|
|
|
ticks: {
|
|
|
|
beginAtZero: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2020-06-06 06:41:57 +09:00
|
|
|
});
|