Public
Edited
Mar 20
1 fork
3 stars
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
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
//zip = FileAttachment("final30.zip").zip()
Insert cell
//tmp = zip.file("final30.json").json()
Insert cell
zip = FileAttachment("data.zip").zip()
Insert cell
data = zip.file("data.json").json()
Insert cell
// data = geo.featurecollection(
// tmp.features.map((d) => ({
// type: "Feature",
// geometry: d.geometry,
// properties: {
// type: d.properties.type,
// span: d.properties.span,
// min: d.properties.min,
// max: d.properties.max ? d.properties.max : d.properties.min + 1,
// center: d.properties.center,
// value: d.properties.center ? d.properties.center : d.properties.min + 1
// }
// }))
// )
Insert cell
Insert cell
spans.get(span)
Insert cell
accessor(variable, type)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
regions = geo.union(departements, { id: "REG" })
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
geo = require("geotoolbox")
Insert cell
viz = require("geoviz@0.7.1")
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
dicopal = require("dicopal")
Insert cell
dicopal
Insert cell
Insert cell
span10 = geo.filter(data, (d) => d.span == 10)
Insert cell
new Set(span10.features.map((d) => d.properties.type))
Insert cell
bx = geo.filter(span10, (d) => d.type == "eq_pot_bx_ptc")
Insert cell
viz.path({ data: bx, tip: true })
Insert cell
vote_com_pt
Insert cell
exp = d3.sum(
vote_com_pt
.filter(
(d) => d["Code.département"] == "2B" || d["Code.département"] == "2A"
)
.map((d) => +d.Exprimés)
)
Insert cell
xd = d3.sum(
vote_com_pt
.filter(
(d) => d["Code.département"] == "2B" || d["Code.département"] == "2A"
)
.map((d) => +d.nbvoix_BX)
)
Insert cell
(xd / exp) * 100
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