Published
Edited
Dec 28, 2021
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
vehicules = [
{ name: 'train', display: "🚞🚃🚃🚃🚃", seats: 440 },
{ name: 'airplane', display: "✈️", seats: 350 },
{ name: 'bus', display: "🚎", seats: 150 },
{ name: 'car', display: "🚙", seats: 4 },
{ name: 'bike', display: "🚲", seats: 1 },
]
Insert cell
mutable lastUpdate = new Date()
Insert cell
franceCovid = {
mutable lastUpdate = new Date()
yield d3.csv('https://www.data.gouv.fr/fr/datasets/r/f335f9ea-86e3-4ffa-9684-93c009d5e617')
}
Insert cell
deaths = {
let data = d3.sort(franceCovid, d => d.date).map(d => ({ date: d.date , cum: parseInt(d.dc_tot)||0 }))

data = data.map( (d,i) => {
let date = d.date
let cum = d.cum
let daily = data[i].cum - (data[i-1]?.cum||0)
daily = d3.max([daily, 0])
return { date, cum, daily }
})
return data
}

Insert cell
Insert cell
allVehicules(2555)
Insert cell
allVehicules = (n) => {
let str = ''
let current = n

vehiculesCheckbox.map( v =>{
let nb = Math.floor(current/v.seats)
str += `${v.display} `.repeat(nb)
current -= nb * v.seats
})
return str
}
Insert cell
trains = (n)=>{
'🚞'
return '🚞'+'🚃'.repeat(Math.floor(n/110))
}
Insert cell
d3 = require('d3', 'd3-time')
Insert cell
import {tweet} from '@mbostock/tweet'
Insert cell
import {Range, Select, Checkbox } from '@observablehq/inputs'
Insert cell
import {datasetCard} from '@taniki/datagouvfr-oembed'
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