Public
Edited
Dec 15, 2020
1 fork
Insert cell
Insert cell
Insert cell
communityAreasSvg = 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]);

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