org.moxieapps.gwt.highcharts.client
Interface ToolTipFormatter
public interface ToolTipFormatter
An interface that can be used to control the information of the tooltip area to contain
custom text or formatting. General usage is as follows:
chart.setToolTip(
new ToolTip()
.setToolTipFormatter(new ToolTipFormatter() {
public String format(ToolTipData toolTipData) {
return toolTipData.getXAsLong() + " degrees";
}
})
);
See the documentation on the format(ToolTipData)
function for more details on the
capabilities available within custom formatters.
- Since:
- 1.0.0
- Author:
- squinn@moxiegroup.com (Shawn Quinn)
format
String format(ToolTipData toolTipData)
- Callback function to format the text of the tooltip. Return null to disable tooltip for a specific
point on series.
A subset of HTML is supported. The HTML of the tooltip 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.
Since version 2.1 the tooltip can be shared between multiple series through the
ToolTip.setShared(boolean)
option. The available data in the formatter differ a bit depending
on whether the tooltip is shared or not. In a shared tooltip, all properties except x, which is common
for all points, are kept in an array, this.points.
Available data provided in the given "ToolTipData" object are:
-
percentage (not shared) or points[i].percentage (shared) :
Stacked series and pies only. The point's percentage of the total.
-
point.name (not shared) or points[i].point.name (shared) :
The "name" property of the point object that hte tooltip is hovering over.
-
series.name (not shared) or points[i].series.name (shared) :
The name of the series that the point is a part of.
-
total (not shared) or points[i].total (shared) :
Stacked series only. The total value at this point's x value.
-
x :
The x value. This property is the same regardless of the tooltip being shared or not.
-
y (not shared) or points[i].y (shared) :
The y value.
- Parameters:
toolTipData
- An object containing all of the data available to the formatter that it can
use to determine which text and styling to use in the tooltip.
- Returns:
- The text to include in the tooltip (including any styling), or null to disable the tooltip
for the data point.
Copyright © 2015. All Rights Reserved.