Published unlisted
Edited
Apr 20, 2021
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
chart = {
// create an SVG with the width and height specified
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);

// draw map
svg.append('g')
.selectAll('path')
.data(countries.features)
.enter()
.append('path')
.attr('d', path)
.attr('stroke', '#fff')
.attr('stroke-width', 0.5)
.attr('fill', d => {
if (label.includes(d.properties.name)) // error seems occurs here?
{ return 'green' }
else
{ return '#E0E0E0' }
})

//
return svg.node();
}
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