Published
Edited
Oct 11, 2021
Importers
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
instituts = [... new Set(sondages.map(s => s.nom_institut))]
.map(i => ({
institut: i,
sondages: sondages.filter(s => s['nom_institut'] == i),
regions: [...new Set(sondages.filter(s => s['nom_institut'] == i).map(s => s.region))]
}))
.sort((a,b) => b.sondages.length - a.sondages.length)
Insert cell
Insert cell
Insert cell
Inputs.table(commanditaires)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Inputs.table(candidats)
Insert cell
candidats = sondages.map(s => s.tours.map(t => t.hypotheses.map(h => h.candidats.map(tl => ({ tour: t.tour, sondage: s.id, hypothese: h.hypothese,...tl}))))).flat(11)
Insert cell
Insert cell
Insert cell
Insert cell
tours = [... new Set(sondages.map(s => s.tours.map(t => t.tour)).flat(3))]
.map(t => ({
tour: t,
hypotheses: hypotheses.filter(h => h.tour == t)
}))
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
sondages = {
let raw = await d3.json('https://raw.githubusercontent.com/nsppolls/nsppolls/master/presidentielle.json')
return raw.sort((a,b) => b.fin_enquete.localeCompare(a.fin_enquete))
}
Insert cell
// import { sondages } from '@taniki/regionales2021-sondages'
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