chrt.Chrt()
.size(width, 300)
.x({scale:'time'})
.add(
chrt.xAxis()
.interval('year')
.format((x, i) => {
const d = new Date(x);
const month = d.toLocaleString(undefined, {month: "short"})
if(!i || !d.getMonth()) {
return `${d.getFullYear()}`;
}
return month;
})
)
.add(chrt.yAxis())
.add(
chrt.line()
.data(weekly_fuel_prices_from_2005_to_20230124, (d,i) => ({
x: new Date(d.SURVEY_DATE),
y: d['EURO-SUPER_95']
}))
)
.add(
chrt.line()
.data(weekly_fuel_prices_from_2005_to_20230124, (d,i) => ({
x: new Date(d.SURVEY_DATE),
y: d['AUTOMOTIVE_GAS_OIL']
}))
.color('#f00')
)
.node()