Skip to content

Commit

Permalink
example of formatting legend items
Browse files Browse the repository at this point in the history
because, why not.
  • Loading branch information
gordonwoodhull committed Jul 28, 2016
1 parent 6ebec04 commit 71786ee
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions web/examples/pie-external-labels.html
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand Down

0 comments on commit 71786ee

Please sign in to comment.