Class: htmlLegend

dc. htmlLegend


new htmlLegend()

htmlLegend is a attachable widget that can be added to other dc charts to render horizontal/vertical legend labels.

Source:
Returns:
Type
dc.htmlLegend
Example
chart.legend(dc.htmlLegend().container(legendContainerElement).horizontal(false))

Methods


legendText( [legendText])

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.

Parameters:
Name Type Argument Description
legendText function <optional>
Source:
Returns:
Type
function | dc.htmlLegend
Example
// default legendText
legend.legendText(dc.pluck('name'))

// create numbered legend items
chart.legend(dc.htmlLegend().legendText(function(d, i) { return i + '. ' + d.name; }))

// create legend displaying group counts
chart.legend(dc.htmlLegend().legendText(function(d) { return d.name + ': ' d.data; }))

maxItems( [maxItems])

Maximum number of legend items to display

Parameters:
Name Type Argument Description
maxItems Number <optional>
Source:
Returns:
Type
dc.htmlLegend