diff --git a/Changelog.md b/Changelog.md index c7d9c94c9..354a48829 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,7 +1,9 @@ # 2.0 Series ## 2.0.0 beta 32 -* Improved implementation of alignYAxes, by Mohamed Gazal and Gordon Woodhull ([#1033](https://github.com/dc-js/dc.js/pull/1033)) * 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. +* `legend.legendText` documentation was missing. ## 2.0.0 beta 31 * Brush was sometimes not displaying, fix by Paul Briton ([#1134](https://github.com/dc-js/dc.js/issues/1134)) diff --git a/src/legend.js b/src/legend.js index 27b84d01c..ad9958091 100644 --- a/src/legend.js +++ b/src/legend.js @@ -250,26 +250,30 @@ dc.legend = function () { }; /** - #### .legendText([legendTextFunction]) - Set or get the legend text function. The legend widget uses this function to render - the legend text on each item. If no function is specified the legend widget will display - the names associated with each group. - - Default: dc.pluck('name') - - ```js - // create numbered legend items - chart.legend(dc.legend().legendText(function(d, i) { return i + '. ' + d.name; })) - - // create legend displaying group counts - chart.legend(dc.legend().legendText(function(d) { return d.name + ': ' d.data; })) - ``` - **/ - _legend.legendText = function (_) { + * Set or get the legend text function. The legend widget uses this function to render the legend + * text for each item. If no function is specified the legend widget will display the names + * associated with each group. + * @method legendText + * @memberof dc.legend + * @instance + * @param {Function} [legendText] + * @return {Function} + * @return {dc.legend} + * @example + * // default legendText + * legend.legendText(dc.pluck('name')) + * + * // create numbered legend items + * chart.legend(dc.legend().legendText(function(d, i) { return i + '. ' + d.name; })) + * + * // create legend displaying group counts + * chart.legend(dc.legend().legendText(function(d) { return d.name + ': ' d.data; })) + **/ + _legend.legendText = function (legendText) { if (!arguments.length) { return _legendText; } - _legendText = _; + _legendText = legendText; return _legend; };