我很喜欢使用topojson玩耍,但是在topojson的V1版本中,topojson.object变量未定义。然而,在V0版本中支持该变量。有人能解释一下我应该如何解决这个问题吗?我尝试为格式化为topojson的输入文件中的每个多边形绘制不同的路径元素。代码如下:
d3.json("maTopo.json", function(error, ma) {
svg.selectAll(".subunit")
.data(topojson.object(ma, ma.objects.ma).geometries)
.enter().append("path")
.attr("class", function(d) { return "subunit " + d.id; })
.attr("d", path);
});