d3js v7
using geojson to draw a china map, i can't fill color to any area.
let width = 700;
let height = 700;
var projection = d3
.geoMercator()
.scale(width * 0.75)
.center([121, 38]);
var path = d3.geoPath().projection(projection);
var map = d3
.select("body")
.append("svg")
.attr("width", width)
.attr("height", height);
d3.json(
"https://geo.datav.aliyun.com/areas_v3/bound/geojson?code=100000_full"
).then((data: any) => {
map
.selectAll("path")
.data(data.features)
.enter()
.append("path")
.attr("d", path)
.attr("fill", "none")
.attr("stroke", "black");
});
when fill color with none
, it can work
when using other color, it fail
attr("fill", "#0ea5e9")