1
0
Fork 0
mirror of https://github.com/Findus23/RainbowRoad.git synced 2024-09-18 14:53:51 +02:00
RainbowRoad/src/stats.ts

37 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,
},
}
);
}