Published
Edited
Nov 12, 2020
Insert cell
md`# Graph of Covid-19 case in Jakarta `
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import {covid_id} from '@binarmaya/covid-19-data-time-series-in-indonesia-by-province'
Insert cell
import {viewDataTransformed } from '@binarmaya/view-data-transformed-by-vega'
Insert cell
import {ETtoDate} from '@binarmaya/epoch'
Insert cell
Insert cell
Insert cell
Insert cell
yaxes = {return { "orient": "left", "scale": "yscale", "grid": true }}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
embed = require("vega-embed@6")
Insert cell
Insert cell
Insert cell
specdf=spec("df")
Insert cell
RectMark = (dataName, xfield, yfield)=> {return {
"type": "rect",
"from": {"data": dataName},
"encode": {
"enter": {
"x": {"scale": "xscale", "field": xfield},
"width": {"value": 2},
"y": {"scale": "yscale", "field": yfield },
"y2": {"scale": "yscale", "value": 0},
}
}
}
}
Insert cell
Insert cell
Insert cell
[...data("data",averagaData),
...data("dataMax",maxData)]
Insert cell
Insert cell
maxData ={
const transform =[{
"groupby":[],
"type": "aggregate",
"fields": ["adc","adc"],
"ops": ["max","argmax"],
"as":["max_adc","argmax_adc"]
}]

return viewDataTransformed(averagaData,transform)
}
Insert cell
PoinMark = (dataName, xfield, yfield)=> {return {
"type": "symbol",
"from": {"data": dataName},
"encode": {
"enter": {
"x": {"scale": "xscale", "field": "argmax_adc[\"timestamp\"]"},
"y": {"scale": "yscale", "field": "max_adc" },
"stroke":{"value": "red"},
"fill": {"value": "transparent"}
}
}
}
}
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