org.moxieapps.gwt.highcharts.client.labels
Interface DataLabelsFormatter
public interface DataLabelsFormatter
An interface that can be used to control the display of the data labels displayed within a
series. General usage is as follows:
chart.setSeriesPlotOptions(
new SeriesPlotOptions()
.setDataLabels(
new DataLabels()
.setFormatter(new DataLabelsFormatter() {
public String format(DataLabelsData dataLabelsData) {
return dataLabelsData.getYAsLong() + " degrees";
}
})
)
);
See the documentation on the format(DataLabelsData)
function for more details on the
capabilities available within custom formatters.
- Since:
- 1.0.0
- Author:
- squinn@moxiegroup.com (Shawn Quinn)
format
String format(DataLabelsData dataLabelsData)
- Callback function to format the text of a data label.
A subset of HTML is supported. The HTML of the label is parsed and converted to SVG, therefore
this isn't a complete HTML renderer. The following tags are supported: <b>, <strong>, <i>,
<em>, <br/>, and <span>. Spans can be styled with a style attribute, but only text-related
CSS that is shared with SVG is handled.
Available data provided in the given "DataLabelsData" object are:
-
percentage : Stacked series and pies only. The point's percentage of the total.
-
point.name : The point objects name, if defined.
-
series.name : The name of the series that the data label is part of.
-
total : Stacked series only. The total value at this point's x value.
-
x : The X value of the point.
-
y : The Y value of the point.
- Parameters:
dataLabelsData
- An object containing all of the data available to the formatter that it can
use to determine which text and styling to use for the label.
- Returns:
- The text to display for the label (including any styling).
Copyright © 2015. All Rights Reserved.