Public
Edited
Mar 14, 2022
Insert cell
Insert cell
Insert cell
wardsSvg = function(geoJsonFeaturesCollection) {
const height = 1.3 * width;
const projection = d3.geoMercator()
.fitSize([width, height], geoJsonFeaturesCollection);

const pathGenerator = d3.geoPath()
.projection(projection);
const svg = d3.create('svg')
.attr("viewBox", [0, 0, width, height]);

svg.append('g')
.selectAll('path')
.data(geoJsonFeaturesCollection.features)
.enter()
.append('path')
.attr('d', pathGenerator)
.attr('fill', d => 'lightSkyBlue')
.append('title')
.text(d => 'Ward ' + d.properties.ward);
return svg.node();
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
wardsGeoJson = d3.json(wardsUrl)
Insert cell
Insert cell
Insert cell
Insert cell
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