Published
Edited
Jul 1, 2022
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof variable = DOM.select(["casos_dx", "fallecidos","internados"])
Insert cell
Insert cell
Insert cell
Insert cell
states = [...d3.group(Object.values(dataLoaded), d => d.denominacion).keys()]
Insert cell
cases_per_day = d3.sort(Object.values(dataLoaded).map(d=>{
return {
state : d.denominacion,
data : d[variable].map((e,i)=> {
return{
date: d3.utcDay.offset(new Date(d.fecha_inicial.slice(0,10)),i),
value: e/d.poblacion.personas*1000000,
valueAbs: e
}
})
}
}),
s => -d3.sum(s.data.map(d => d.value))
)
Insert cell
interval = d3.utcDay
Insert cell
start = new Date("2020-04-01")
Insert cell
stop = d3.max(cases_per_day[0].data, (d) => d.date)
Insert cell
Insert cell
// Setting defaults
timeChart = TimeChart.defaults({
interval,
start,
stop,
dateFormat: "%Y-%m-%d",
width: width,
marginTop: 2,
scheme: "reds",
height: 35,
marginTop:0,
locale: "es-AR"
})
Insert cell
import {movingAverage} from "@d3/moving-average"
Insert cell
import { TimeChart, TimeAxis, d3 } from "@observablehq/timechart"
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