在CMD中,网站成功读取了数据,但为什么不能在网站上显示地图?
<script>
var canvas = d3.select("body").append("svg")
.attr("width", 760)
.attr("height", 700);
d3.json("macau.geojson", function (data){
var group = canvas.selectAll("g")
.data(data.features)
.enter()
.append("g");
var projection =d3.geoMercator().scale(10000000).translate([0,1980]);
var path = d3.geoPath().projection(projection);
var areas = group.append("path")
.attr("d", path)
[enter image description here][1] .attr("class", "area")
.attr("fill", "steelblue");
});
</script>
macao.geojson
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[113.54086875915527,22.210609843277137],[113.54172706604004,22.208225959938066],[113.53692054748535,22.20623935955572],[113.53734970092772,22.204411662369296],[113.53657722473145,22.200199921729165],[113.53503227233887,22.195431760974266],[113.53468894958496,22.193683394797116],[113.53005409240723,22.188358691003128],[113.53022575378418,22.18700761465282],[113.52876663208008,22.183510650823948],[113.53039741516113,22.180331517275036],[113.53262901306152,22.178582963167628],[113.54241371154785,22.179695681934852],[113.54979515075684,22.18176213627237],[113.55194091796875,22.185815477671095],[113.55563163757324,22.187404991398775],[113.55640411376953,22.185259143617884],[113.55769157409668,22.186530761074014],[113.55846405029297,22.189312384133],[113.55640411376953,22.196464876211333],[113.56198310852051,22.1988489592878],[113.5616397857666,22.201550871171154],[113.56121063232422,22.20608043031036],[113.56060981750488,22.211007153229815],[113.55571746826172,22.213867751679715],[113.54919433593749,22.21577478491156],[113.54593276977538,22.21585424406701],[113.5433578491211,22.214980190881906],[113.54086875915527,22.210609843277137]]]}}]}