Published
Edited
Jan 29, 2020
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
history_c = d.historylist
.map((d0, i) => {
if (i < d.historylist.length - 1) {
d0.cn_c = d0.cn_conNum / d.historylist[i + 1].cn_conNum;
d0.wuhan_c = d0.wuhan_conNum / d.historylist[i + 1].wuhan_conNum;
}
return d0;
})
.slice(0, d.historylist.length - 5)
Insert cell
vl
.hconcat(
vl
.markBar()
.encode(
vl.x().fieldO('date'),
vl.y().fieldQ('wuhan_c'),
vl.color().value('red'),
vl.opacity().value(0.5)
),
vl
.markBar()
.encode(
vl.x().fieldO('date'),
vl.y().fieldQ('cn_c'),
vl.color().value('blue'),
vl.opacity().value(0.5)
)
)
.data(history_c)
.render()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more