我一直在拼命地试图改变我用nvd3.js绘制的图表上的标签文本颜色-它们是用黑色绘制的,但我需要它们是白色的,因为它们包含在页面上的颜色。
我正在使用nvd3.js版本1.1.15BETA和d3.js版本3.3.13,通过angularjs-nvd3-directives版本0.0.7集成到我的AngularJS应用程序中。
有没有人对如何实现这一点有什么建议?
谢谢。
发布于 2014-07-04 21:16:55
要更改图表中的文本颜色,请尝试执行以下操作:
svg text {
fill: white;
}更改饼图中的标签颜色
.nvd3.nv-pie .nv-slice text {
fill: white !important;
}这是一个working fiddle。
希望能有所帮助
发布于 2014-07-21 00:38:46
希望它能有所帮助:
在您的控制器中:
$scope.callbackFunction = function(){
return function(){
d3.selectAll('.nv-pieLabels text').style('fill', "white");
}
}在超文本标记语言中(唯一重要的是callback=callbackFunction()):
<nvd3-pie-chart
data="exampleData"
id="exampleId"
color="colorFunction()"
width="1100"
height="700"
x="xFunction()"
y="yFunction()"
rotateLabels="120"
showLabels="true"
callback="callbackFunction()">
<svg></svg>
</nvd3-pie-chart>致谢对象:
https://github.com/cmaurer/angularjs-nvd3-directives/blob/master/examples/nvd3.callback.html和https://github.com/krispo/angular-nvd3/issues/8
https://stackoverflow.com/questions/24574418
复制相似问题