I have created a pie chart with the following code. I get the result for that, but I need a small favour.
<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>
Now please tell me how to change the font color of the numbers in percentage to black
.