diff --git a/web/examples/pie.html b/web/examples/pie.html index 220d7dcd8..a43e25923 100644 --- a/web/examples/pie.html +++ b/web/examples/pie.html @@ -28,7 +28,13 @@ .innerRadius(100) .dimension(runDimension) .group(speedSumGroup) - .legend(dc.legend()); + .legend(dc.legend()) + // workaround for #703: not enough data is accessible through .label() to display percentages + .on('pretransition', function(chart) { + chart.selectAll('text.pie-slice').text(function(d) { + return d.data.key + ' ' + dc.utils.printSingleValue((d.endAngle - d.startAngle) / (2*Math.PI) * 100) + '%'; + }) + }); chart.render(); });