{
const index = 0;
const maxRank = 100;
const attributes = stable13445;
const pops = pops13445;
const chart = chrt.Chrt()
.size(width, 700)
.margins({left: 20, bottom: 40})
.padding({left: 20, bottom: 5, right: 20})
.x({scale:'time'})
.y({domain:[30,1]})
.add(
chrt.horizontalGrid(30).color('#ddd')
)
Object.values(pops).slice(0, 50).forEach((pop, asnIndex) => {
chart.add(
chrt.line()
.data(pop.data.filter(d => d.rank<= maxRank && new Date(d.Date) >= new Date(2023,8,1)), d => ({
x: new Date(d.Date),
y: d.rank,
}))
.class(pop.location)
.stroke(attributes[pop.location]?.color ?? '#aaa')
.strokeWidth(attributes[pop.location]?.thickness ?? 1)
.strokeOpacity(attributes[pop.location]?.opacity ?? 0.25)
)
chart.add(
chrt.points()
.data(pop.data.filter(d => d.rank<= 30 && new Date(d.Date) >= new Date(2023,8,1)), d => ({
x: new Date(d.Date),
y: d.rank,
}))
.fill(attributes[pop.location]?.color ?? '#aaa')
.size({field: 'Num Traces', range: [0,20]})
.fillOpacity(attributes[pop.location]?.opacity ?? 0.25)
)
})
chart.add(
chrt.yAxis(30).hideTicks().hideAxis()
).add(
chrt.xAxis()
.interval('bidiurnal')
.format(d => new Date(d).toLocaleDateString('en-us', { day:'numeric', month:"numeric"})).hideTicks().hideAxis()
)
return chart.node()
}