Chart.LegendFormatter

Syntax

LegendFormatter: Function;

Description

The LegendFormatter property determines formatting applied to chart legend items.

Comments

The property value is set in the Chart constructor or using the setLegendFormatter method and is returned using the getLegendFormatter method.

Example

To execute the example, the HTML page must contain the Chart component named chart (see Example of Creating a Histogram). Set formatting for chart legend labels:

// Set formatting of chart legend labels
chart.setLegendFormatter(function(item) {
    return '[' + item.name + ']';
});
// Redraw the chart
chart.redraw(true);

After executing the example square brackets are added to labels of the chart legend:

See also:

Chart