Javascript D3图表,用<;tspan>;没有出现
我用d3图表做了一些图表 我还通过模拟节点的代码来添加每个节点的文本 像这样Javascript D3图表,用<;tspan>;没有出现,javascript,d3.js,svg,Javascript,D3.js,Svg,我用d3图表做了一些图表 我还通过模拟节点的代码来添加每个节点的文本 像这样 this.text .enter() .append("svg:text") .attr("class", "nodetext") .classed("directory", d => (d._children || d.children ? 1 : 0)) .text(d => "There is a long long long words") .attr
this.text
.enter()
.append("svg:text")
.attr("class", "nodetext")
.classed("directory", d => (d._children || d.children ? 1 : 0))
.text(d => "There is a long long long words")
.attr("name", d => 'd.name')
.attr("dy", d => -16)
.attr("dx", d => 0)
.attr("text-anchor", "middle")
.call(this.force.drag);
但是现在因为文本太长而无法显示。我只需要一行大约10个字符
因此,我在文本代码之后添加了一些
this.text
.enter()
.append("svg:text")
.attr("class", "nodetext")
.classed("directory", d => (d._children || d.children ? 1 : 0))
.attr("name", d => 'd.name')
.attr("dy", d => -16)
.attr("dx", d => 0)
.attr("text-anchor", "middle")
.call(this.force.drag)
.append("tspan")
.text(d => "There is a long long logn words")
.attr("dx", 0)
.attr("dy", 14)
.attr("fill", "#000");
但具有的图表不会显示在购物车中
当我检查chrome的开发工具时。这是我的信息
所以。。。是什么原因使信息不出现在图表中
我只是在代码笔上按了一个极小值。我用
.append(“svg:tspan”)
然后将文本引用换行你能在这里添加一个吗?是的,我只是把代码推上