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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more