diff --git a/Changelog.md b/Changelog.md index 354a48829..748f49e28 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,7 +2,7 @@ ## 2.0.0 beta 32 * elasticY and elasticX did not work if all values were negative (coordinate grid and row charts, respectively), by Sebastian Gröhn ([#879](https://github.com/dc-js/dc.js/issues/879) / [#1156](https://github.com/dc-js/dc.js/pull/1156)) * Improved implementation of alignYAxes, by Mohamed Gazal and Gordon Woodhull ([#1033](https://github.com/dc-js/dc.js/pull/1033)) -* Example of downloading the table data as it's formatted. +* Examples of downloading the table data as it's formatted, and formatting legend items. * `legend.legendText` documentation was missing. ## 2.0.0 beta 31 diff --git a/web/examples/pie-external-labels.html b/web/examples/pie-external-labels.html index 1ef9d21b3..a8adeaf1c 100644 --- a/web/examples/pie-external-labels.html +++ b/web/examples/pie-external-labels.html @@ -36,6 +36,18 @@ .group(speedSumGroup) .legend(dc.legend()); + // example of formatting the legend via svg + // http://stackoverflow.com/questions/38430632/how-can-we-add-legends-value-beside-of-legend-with-proper-alignment + chart.on('pretransition', function(chart) { + chart.selectAll('.dc-legend-item text') + .text('') + .append('tspan') + .text(function(d) { return d.name; }) + .append('tspan') + .attr('x', 100) + .attr('text-anchor', 'end') + .text(function(d) { return d.data; }); + }); chart.render(); });