Set the container selector for the legend widget. Required.
This can be optionally used to enable highlighting legends for the selections/filters for the chart.
Display the legend horizontally instead of vertically
This can be optionally used to override class for legenditem and just use this class style. This is helpful for overriding the style of a particular chart rather than overriding the style for all charts.
Setting this will disable the highlighting of selected items also.
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.
// default legendText
legend.legendText(d => d.name)
// create numbered legend items
chart.legend(new HtmlLegend().legendText(function(d, i) { return i + '. ' + d.name; }))
// create legend displaying group counts
chart.legend(new HtmlLegend().legendText(function(d) { return d.name + ': ' d.data; }))
Maximum number of legend items to display
Generated using TypeDoc
htmlLegend is a attachable widget that can be added to other dc charts to render horizontal/vertical legend labels.
Example