下面是在圆圈内绘制文字的代码,我希望这个文字用白色而不是黑色填充,但它是黑色而不是白色。知道这些代码有什么问题。为什么文字是黑色而不是白色
d3text.text(value); // value is dynamically generated text
d3text.style('font-size', function() {
myFontSize = Math.min(2 * (radiusSize - 16), (2 * radiusSize - 16) /
((this.getComputedTextLength() + 16) * 2) * 24);
myFontSize = Math.round((myFontSize < 12) ? MINFONTSIZE : myFontSize);
return (myFontSize + 'px');
});
d3text.style('fill', 'while');
d3text.textAnchor = 'middle';
答案 0 :(得分:1)
将d3text.style('fill', 'while');
更改为d3text.style('fill', 'white');