JavaScript:
nv.addGraph(function() {
var chart = nv.models.pieChart()
.x(function(d) { return d.label })
.y(function(d) { return d.value })
.color(['#d0212a', '#2f587f'])
.showLabels(false)
.donut(true)
.donutRatio(0.50)
.showLegend(false)
.tooltips(false);
d3.select("#chart svg")
.datum(data)
.transition().duration(500)
.call(chart);
return chart;
});
HTML:
<style>
#chart svg {
height: 200px;
}
</style>
<div id="chart">
<svg></svg>
</div>
Data:
[
{
"label": "One",
"value" : 29.765957771107
} ,
{
"label": "Two",
"value" : 14
}
]