我使用以下代码创建了一个饼图。我得到了结果,但我需要一点帮助。
<html lang="en">
<body>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="http://dc-js.github.io/dc.js/css/dc.css"/>
</head>
<div id="billplan"></div>
<script type="text/javascript" src="js/d3.js"></script>
<script type="text/javascript" src="https://dc- js.github.io/dc.js/js/crossfilter.js"></script>
<script type="text/javascript" src="js/dc.js"></script>
<script type="text/javascript">
var billplanchart = dc.pieChart("#billplan");
d3.csv("data/billplanchart.csv", function(error, experiments) {
var ndx = crossfilter(experiments),
planrate = ndx.dimension(function(d) {return d.plan_amount;}),
billplandimgroup = planrate.group().reduceSum(function(d) {return (Math.round(d.Count));});
billplanchart
.width(240)
.height(80)
.dimension(planrate)
.group(billplandimgroup)
.slicesCap(5)
.innerRadius(10)
.colors(d3.scale.ordinal().range(["#FFDA33","#05BCDC","#EA7262","#0071CF","#58A531","#E51F30"]))
.legend(dc.legend())
.on('pretransition', function(chart2) {
chart2.selectAll('text.pie-slice').text(function(d) {
return Math.round(dc.utils.printSingleValue((d.endAngle - d.startAngle) / (2*Math.PI) * 100)*10)/10+ '%';
})
});
billplanchart.render();
});
</script>
</body>
</html>
现在请告诉我如何将数字的字体颜色更改为black
。