【发布时间】:2023-06-05 10:55:01
【问题描述】:
我有一张包含德国和叙利亚各州及其城市的世界地图。如您所见,现在它们完全随机加载。
叙利亚城市根本没有装载。当我重新加载它时,它会随机成为我发布的图片之一。
例如,这是我调用德国的函数。
d3.json("germany.topo.json", function(error, ger){
if (error) throw error;
var states = topojson.feature(ger, ger.objects.states_germany),
cities = topojson.feature(ger, ger.objects.cities_germany);
g.selectAll(".states")
.data(states.features)
.enter()
.append("path")
.attr("class", "state")
.attr("class", function(d) { return "state " + d.id; })
.attr("d", path);
g.append("path")
.datum(cities)
.attr("d", path.pointRadius('0.35'))
.attr("class", "city");
g.selectAll(".place-label")
.data(cities.features)
.enter().append("text")
.attr("class", "place-label")
.attr("transform", function(d) { return "translate(" + projection(d.geometry.coordinates) + ")"; })
.attr("dy", ".35em")
.text(function(d) { return d.properties.name; });
});
日期是here
我可以部分重现此错误。也许你可以看看并告诉我为什么它不能正常工作。 提前致谢
【问题讨论】:
标签: javascript d3.js topojson