JS D3 textPath isn't displayed

跟風遠走 提交于 2019-12-19 10:26:21

问题


i have the code below and wonder, why the textpath isn't displayed? Can anyone help?

var areas = svg.append("g").selectAll("path")
    .data(chord.groups)
    .enter().append("path")
    .style("fill", function(d) { return fill(d.index); })
    .style("stroke", function(d) { return fill(d.index); })
    .attr("class", "bar")
    .attr("id", function(d, i) { return "group" + i; })
    .attr("d", d3.svg.arc().innerRadius(innerRadius).outerRadius(outerRadius))
    .on("mouseover", fade(.1))
    .on("mouseout", fade(1));

svg.selectAll(".bar").append("text")
    .style("font-size", "10px")
    .attr("fill", "black")
.append("textPath")
    .attr("x", 8)
    .attr("dy", ".35em")
    .style("fill", "#ff00ff")
    .attr("xlink:href", function(d, i) { return "#group" + i; })
    .text("Textexample");

Thank you very much! Benjamin

来源:https://stackoverflow.com/questions/16164348/js-d3-textpath-isnt-displayed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!