LegendFormatter: Function;
The LegendFormatter property determines formatting applied to chart legend items.
Use JSON or the setLegendFormatter method to set the property value, and the getLegendFormatter method to get the property value.
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: