mirror of
https://github.com/Findus23/RainbowRoad.git
synced 2024-09-19 16:03:52 +02:00
38 lines
952 B
TypeScript
38 lines
952 B
TypeScript
|
import {AutoScaleAxis, BarChart, FixedScaleAxis, StepAxis} from "chartist";
|
||
|
import 'chartist/dist/index.css';
|
||
|
import {createElement} from "./domutils";
|
||
|
import data from "../stats.json"
|
||
|
|
||
|
export function addStatsChart(el: HTMLElement) {
|
||
|
const chartEl = createElement("div")
|
||
|
chartEl.id = "chart"
|
||
|
el.appendChild(chartEl)
|
||
|
new BarChart(
|
||
|
chartEl,
|
||
|
{
|
||
|
labels: data.labels,
|
||
|
series: [
|
||
|
data.values,
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
seriesBarDistance: 10,
|
||
|
axisX:{
|
||
|
// type: FixedScaleAxis,
|
||
|
// divisor: 10,
|
||
|
// labelInterpolationFnc: value =>
|
||
|
// new Date(value).toLocaleString(undefined, {
|
||
|
// month: 'short',
|
||
|
// year: 'numeric'
|
||
|
// })
|
||
|
|
||
|
},
|
||
|
axisY: {
|
||
|
|
||
|
offset: 20,
|
||
|
},
|
||
|
|
||
|
}
|
||
|
);
|
||
|
}
|