当我加载 json 时,此代码不能与 d3.js 一起使用,然后只显示黑色,没有任何输出如果有任何想法请帮助我,请通过我的代码检查整个代码
<script>
d3.json("nysd.geojson",
function (json) {
//dimensions
var w = 2000;
var h = 2000;
var svg = d3.select("#chart").append("svg")
.attr("width", w)
.attr("height", h);
//create geo.path object, set the projection to merator bring it to the svg-viewport
var path = d3.geo.path()
.projection(d3.geo.mercator()
.scale(20000)
.translate([0, 3800]));
//draw svg lines of the boundries
svg.append("g")
.attr("class", "black")
.selectAll("path")
.data(json.features)
.enter()
.append("path")
.attr("d", path);
});
</script>