【发布时间】:2015-05-17 17:41:44
【问题描述】:
所以我的 SVG 地图上有点,现在我想在它们旁边显示文本。这是一个jsfiddle,有 2 个点并显示其 ID 文本。但正如你所见,不知何故没有文字。
var featureCollection = topojson.feature(topology, topology.objects.testtest);
lines.append("g")
.attr("id", "lines")
.selectAll("path")
.data(featureCollection.features)
.enter().append("path")
.attr("d", path)
.append("text")
.attr("class", "nodetext")
.attr("x", 22)
.attr("y", 4)
.text(function (d) {
return d.properties.id;
});
我用其他一些文本检查了它,除了我已经有 here 的例子。它的工作方式相同。
那么它不适用于路径吗?会这样吗?
【问题讨论】:
标签: javascript jquery css svg d3.js