org.moxieapps.gwt.highcharts.client
Class ToolTip

java.lang.Object
  extended by org.moxieapps.gwt.highcharts.client.Configurable<ToolTip>
      extended by org.moxieapps.gwt.highcharts.client.ToolTip

public class ToolTip
extends Configurable<ToolTip>

A configurable class that can be used to represent custom ToolTip options for the chart, which can then be set on the chart (via the BaseChart.setToolTip(ToolTip) method.) The tooltip appears when the user hovers over a series or point. Example usage:

   chart.setToolTip(
     new ToolTip()
       .setBorderColor("#CC0000")
       .setShadow(true)
   );
 

Since:
1.0.0
Author:
squinn@moxiegroup.com (Shawn Quinn)

Constructor Summary
ToolTip()
           
 
Method Summary
 ToolTip setAnimation(boolean animation)
          Convenience method for setting the 'animation' option for the tool tips.
 ToolTip setBackgroundColor(Color backgroundColor)
          Convenience method for setting the 'backgroundColor' option for the tool tips to a gradient or color with an alpha channel .
 ToolTip setBackgroundColor(String backgroundColor)
          Convenience method for setting the 'backgroundColor' option for the tool tips.
 ToolTip setBorderColor(Color borderColor)
          Convenience method for setting the 'borderColor' option for the tool tips to a gradient or color with an alpha channel .
 ToolTip setBorderColor(String borderColor)
          Convenience method for setting the 'borderColor' option for the tool tips.
 ToolTip setBorderRadius(Number borderRadius)
          Convenience method for setting the 'borderRadius' option for the tool tips.
 ToolTip setBorderWidth(Number borderWidth)
          Convenience method for setting the 'borderWidth' option for the tool tips.
 ToolTip setChangeDecimal(Number changeDecimal)
          convenience method for setting the 'changeDecimal' option for the tool tips.
 ToolTip setCrosshairs(boolean crosshairs)
          Convenience method for setting the 'crosshairs' option for the tool tips for both axis.
 ToolTip setCrosshairs(boolean xCrosshairs, boolean yCrosshairs)
          Convenience method for setting the 'crosshairs' option for the tool tips for each axis separately.
 ToolTip setEnabled(boolean enabled)
          Convenience method for setting the 'enabled' option for the tool tips.
 ToolTip setFollowPointer(boolean followPointer)
          Convenience method for setting the 'followPointer' option for the tool tips.
 ToolTip setFollowTouchMove(boolean followTouchMove)
          Convenience method for setting the 'enabled' option for the tool tips.
 ToolTip setFormatter(ToolTipFormatter toolTipFormatter)
          Sets a custom formatter on the tooltip that can be used to control the contents and styling of the text that appears in the tooltip.
 ToolTip setHeaderFormat(String headerFormat)
          Convenience method for setting the 'headerFormat' option for the tool tips.
 ToolTip setHideDelay(Number hideDelay)
          Convenience method for setting the 'hideDelay' option of the tool tip.
 ToolTip setPointFormat(String pointFormat)
          Convenience method for setting the 'pointFormat' option for the tool tips.
 ToolTip setShadow(boolean shadow)
          Convenience method for setting the 'shadow' option for the tool tips.
 ToolTip setShared(boolean shared)
          Convenience method for setting the 'shared' option for the tool tips.
 ToolTip setSnap(Number snap)
          Convenience method for setting the 'snap' option for the tool tips.
 ToolTip setStyle(Style style)
          Convenience method for setting the 'style' options of the tooltip.
 ToolTip setUseHTML(boolean useHTML)
          Convenience method for setting the 'useHTML' option for the tool tips.
 ToolTip setValueDecimals(Number valueDecimals)
          Convenience method for setting the 'valueDecimals' option for the tool tips.
 ToolTip setValuePrefix(String valuePrefix)
          Convenience method for setting the 'valuePrefix' option for the tool tips.
 ToolTip setValueSuffix(String valueSuffix)
          Convenience method for setting the 'valueSuffix' option for the tool tips.
 ToolTip setXDateFormat(String xDateFormat)
          Convenience method for setting the 'xDateFormat' option for the tool tips.
 
Methods inherited from class org.moxieapps.gwt.highcharts.client.Configurable
getOptions, setOption
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ToolTip

public ToolTip()
Method Detail

setAnimation

public ToolTip setAnimation(boolean animation)
Convenience method for setting the 'animation' option for the tool tips. Equivalent to:

     toolTip.setOption("animation", "true");
 
Enable or disable animation of the tooltip. In slow legacy IE browsers the animation is disabled by default. Defaults to true.

Parameters:
animation - Whether to enable or disable animation of the tooltip.
Returns:
A reference to this ToolTip instance for convenient method chaining.

setBackgroundColor

public ToolTip setBackgroundColor(String backgroundColor)
Convenience method for setting the 'backgroundColor' option for the tool tips. Equivalent to:

     toolTip.setOption("backgroundColor", "#CCCCCC");
 
The RGB background color for the tooltip. Defaults to white with a slight opacity.

Note that this method is intended for setting the color to a simple RBG hex value. If you instead want to set a color to include an alpha channel or a gradient, use the setBackgroundColor(Color) method.

Parameters:
backgroundColor - The RGB background color for the tooltip.
Returns:
A reference to this ToolTip instance for convenient method chaining.

setBackgroundColor

public ToolTip setBackgroundColor(Color backgroundColor)
Convenience method for setting the 'backgroundColor' option for the tool tips to a gradient or color with an alpha channel . Equivalent to:

     toolTip.setOption("backgroundColor", new Color()
        .setLinearGradient(0.0, 0.0, 1.0, 1.0)
        .addStop(new Color(255, 255, 255))
        .addStop(new Color(200, 200, 255))
     ));
 
The background color for the tooltip (as a gradient or color with an alpha channel). Defaults to "rgba(255, 255, 255, .85)".

Note that this method is intended for setting the background to a gradient or color with an alpha channel. If you instead want to just set the color to a standard RGB hex value use the setBackgroundColor(String) method instead.

Parameters:
backgroundColor - The color gradient or color with an alpha channel to set as the 'backgroundColor' option on the tool tip.
Returns:
A reference to this ToolTip instance for convenient method chaining.

setBorderColor

public ToolTip setBorderColor(String borderColor)
Convenience method for setting the 'borderColor' option for the tool tips. Equivalent to:

     toolTip.setOption("borderColor", "#CCCCCC");
 
The color of the tooltip border. When null, the border takes the color of the corresponding series or point. Defaults to "auto".

Note that this method is intended for setting the color to a simple RBG hex value. If you instead want to set a color to include an alpha channel or a gradient, use the setBorderColor(Color) method.

Parameters:
borderColor - The color of the tooltip border.
Returns:
A borderColor to this ToolTip instance for convenient method chaining.

setBorderColor

public ToolTip setBorderColor(Color borderColor)
Convenience method for setting the 'borderColor' option for the tool tips to a gradient or color with an alpha channel . Equivalent to:

     toolTip.setOption("borderColor", new Color()
        .setLinearGradient(0.0, 0.0, 1.0, 1.0)
        .addStop(new Color(255, 255, 255))
        .addStop(new Color(200, 200, 255))
     ));
 
The border color for the tooltip (as a gradient or color with an alpha channel). When null, the border takes the color of the corresponding series or point. Defaults to "auto".

Note that this method is intended for setting the border to a gradient or color with an alpha channel. If you instead want to just set the color to a standard RGB hex value use the setBackgroundColor(String) method instead.

Parameters:
borderColor - The color gradient or color with an alpha channel to set as the 'borderColor' option on the tool tip.
Returns:
A reference to this ToolTip instance for convenient method chaining.

setBorderRadius

public ToolTip setBorderRadius(Number borderRadius)
Convenience method for setting the 'borderRadius' option for the tool tips. Equivalent to:

     toolTip.setOption("borderRadius", 8);
 
The radius of the rounded border corners. Defaults to 5.

Parameters:
borderRadius - The radius of the rounded border corners.
Returns:
A reference to this ToolTip instance for convenient method chaining.

setBorderWidth

public ToolTip setBorderWidth(Number borderWidth)
Convenience method for setting the 'borderWidth' option for the tool tips. Equivalent to:

     toolTip.setOption("borderWidth", 3);
 
The pixel width of the tooltip border. Defaults to 2.

Parameters:
borderWidth - The pixel width of the tooltip border.
Returns:
A reference to this ToolTip instance for convenient method chaining.

setChangeDecimal

public ToolTip setChangeDecimal(Number changeDecimal)
convenience method for setting the 'changeDecimal' option for the tool tips. Equivalent to:

     toolTip.setOption("changeDecimal", 5);
 
How many decimals to show for the point.change value when the series.compare option is set. This is overridable in each series' tooltip options object. The default is to preserve all decimals.

Parameters:
changeDecimal - The number of decimals to show.
Returns:
A reference to this ToolTip instance for convenient method chaining.

setCrosshairs

public ToolTip setCrosshairs(boolean crosshairs)
Convenience method for setting the 'crosshairs' option for the tool tips for both axis. Equivalent to:

     toolTip.setOption("crosshairs", true);
 
Display crosshairs to connect the points with their corresponding axis values. Crosshairs are disabled by default.

Note that see the overloaded versions of this method for other ways to control the crosshair configurations.

Parameters:
crosshairs - Whether or not to display crosshairs to connect the points with their corresponding axis values.
Returns:
A reference to this ToolTip instance for convenient method chaining.

setCrosshairs

public ToolTip setCrosshairs(boolean xCrosshairs,
                             boolean yCrosshairs)
Convenience method for setting the 'crosshairs' option for the tool tips for each axis separately. Equivalent to:

     toolTip.setOption("crosshairs", true, true);
 
Display crosshairs to connect the points with their corresponding axis values. Crosshairs are disabled by default.

Note that see the overloaded versions of this method for other ways to control the crosshair configurations.

Parameters:
xCrosshairs - Whether or not to display the x axis crosshair.
yCrosshairs - Whether or not to display the y axis crosshair.
Returns:
A reference to this ToolTip instance for convenient method chaining.

setEnabled

public ToolTip setEnabled(boolean enabled)
Convenience method for setting the 'enabled' option for the tool tips. Equivalent to:

     toolTip.setOption("enabled", false);
 
Enable or disable the tool tips. Defaults to true.

Parameters:
enabled - Whether or not to enable or disable the tool tips.
Returns:
A reference to this ToolTip instance for convenient method chaining.

setFollowPointer

public ToolTip setFollowPointer(boolean followPointer)
Convenience method for setting the 'followPointer' option for the tool tips. Equivalent to:

     toolTip.setOption("followPointer", true);
 
Whether the tooltip should follow the mouse as it moves across columns, pie slices and other point types with an extent. By default it behaves this way for scatter, bubble and pie series by override in the plotOptions for those series types. For touch moves to behave the same way, setFollowTouchMove(boolean) must be true also.

Parameters:
followPointer - 'true' to make the tooltip follow the mouse pointer.
Returns:
A reference to this ToolTip instance for convenient method chaining.

setFollowTouchMove

public ToolTip setFollowTouchMove(boolean followTouchMove)
Convenience method for setting the 'enabled' option for the tool tips. Equivalent to:

     toolTip.setOption("followTouchMove", true);
 
Whether the tooltip should follow the finger as it moves on a touch device. The default value of false causes a touch move to scroll the web page, as is default behaviour on touch devices. Setting it to true may cause the user to be trapped inside the chart and unable to scroll away, so it should be used with care. Defaults to false.

Parameters:
followTouchMove - 'true' to make the tooltip follow a finger on a touch device.
Returns:
A reference to this ToolTip instance for convenient method chaining.

setFormatter

public ToolTip setFormatter(ToolTipFormatter toolTipFormatter)
Sets a custom formatter on the tooltip that can be used to control the contents and styling of the text that appears in the tooltip. See the ToolTipFormatter interface, and in particular the ToolTipFormatter.format(ToolTipData) method for more details on the capabilities available to custom formatters.

Note that for more simple custom point format cases see the setPointFormat(String) mechanism instead.

Parameters:
toolTipFormatter - The custom formatter to use for the tooltips (if not given a built-in generic formatter is used when tooltips are enabled).
Returns:
A reference to this ToolTip instance for convenient method chaining.

setHeaderFormat

public ToolTip setHeaderFormat(String headerFormat)
Convenience method for setting the 'headerFormat' option for the tool tips. Equivalent to:

     toolTip.setOption("headerFormat", "<span style=\"font-size: 10px\">{point.key}</span><br/>")
 
The HTML of the tooltip header line. Variables are enclosed by curly brackets. Available variables are point.key, series.name, series.color and other members from the point and series objects. The point.key variable contains the category name, x value or datetime string depending on the type of axis. For datetime axes, the point.key date format can be set using setXDateFormat(String). Defaults to <span style="font-size: 10px">{point.key}</span><br/>

Parameters:
headerFormat - The HTML of the tool tip header
Returns:
A reference to this ToolTip instance for convenient method chaining.

setHideDelay

public ToolTip setHideDelay(Number hideDelay)
Convenience method for setting the 'hideDelay' option of the tool tip. Equivalent to:

     toolTip.setOption("hideDelay", 500)
 
The number of milliseconds to wait until the tooltip is hidden when mouse out from a point or chart. Defaults to 500.

Parameters:
hideDelay - the number of miliseconds to wait before hiding the tooltip.
Returns:
A reference to this ToolTip instance for convenient method chaining.

setPointFormat

public ToolTip setPointFormat(String pointFormat)
Convenience method for setting the 'pointFormat' option for the tool tips. Equivalent to:

     toolTip.setOption("pointFormat", "{point.y});
 
The HTML of the point's line in the tooltip. Variables are enclosed by curly brackets. Available variables are point.x, point.y, series.name and series.color and other properties on the same form. Furthermore, point.y can be extended by the tooltip.yPrefix and tooltip.ySuffix variables. This can also be overridden for each series, which makes it a good hook for displaying units.

Defaults to <span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b><br/>

Note that for more advanced use cases, see the setFormatter(ToolTipFormatter) mechanism instead.

Parameters:
pointFormat - The HTML of the point's line in the tooltip.
Returns:
A reference to this ToolTip instance for convenient method chaining.
Since:
1.4.0

setShadow

public ToolTip setShadow(boolean shadow)
Convenience method for setting the 'shadow' option for the tool tips. Equivalent to:

     toolTip.setOption("shadow", false);
 
Whether to apply a drop shadow to the tooltip. Defaults to true.

Parameters:
shadow - Whether to apply a drop shadow to the tooltip.
Returns:
A reference to this ToolTip instance for convenient method chaining.

setShared

public ToolTip setShared(boolean shared)
Convenience method for setting the 'shared' option for the tool tips. Equivalent to:

     toolTip.setOption("shared", true);
 
When the tooltip is shared, the entire plot area will capture mouse movement, and tooltip texts for all series will be shown in a single bubble. This is recommended for single series charts and for iPad optimized sites. Defaults to false.

Parameters:
shared - Whether or not to shared the same tool tip between points.
Returns:
A reference to this ToolTip instance for convenient method chaining.

setSnap

public ToolTip setSnap(Number snap)
Convenience method for setting the 'snap' option for the tool tips. Equivalent to:

     toolTip.setOption("snap", 40);
 
Proximity snap for graphs or single points. Does not apply to bars, columns and pie slices. It defaults to 10 for mouse-powered devices and 25 for touch devices.

Parameters:
snap - The proximity snap for graphs or single points.
Returns:
A reference to this ToolTip instance for convenient method chaining.

setStyle

public ToolTip setStyle(Style style)
Convenience method for setting the 'style' options of the tooltip. Equivalent to:

     toolTip.setOption("/style/fontWeight", "bold");
     toolTip.setOption("/style/fontFamily", "serif");
     etc.
 
CSS styles for the tooltip. The tooltip can also be styled through the CSS class ".highcharts-tooltip". Default value:

Parameters:
style - CSS styles for the tooltip.
Returns:
A reference to this ToolTip instance for convenient method chaining.

setValueDecimals

public ToolTip setValueDecimals(Number valueDecimals)
Convenience method for setting the 'valueDecimals' option for the tool tips. Equivalent to:

     toolTip.setOption("valueDecimals", 3);
 
How many decimals to show in each series' y value. This is overridable in each series' tooltip options object. The default is to preserve all decimals.

Parameters:
valueDecimals - How many decimals to show in each series' y value.
Returns:
A reference to this ToolTip instance for convenient method chaining.
Since:
1.4.0

setValuePrefix

public ToolTip setValuePrefix(String valuePrefix)
Convenience method for setting the 'valuePrefix' option for the tool tips. Equivalent to:

     toolTip.setOption("valuePrefix", "$");
 
A string to prepend to each series' y value. Overridable in each series' tooltip options object. Defaults to "".

Parameters:
valuePrefix - The string to prepend to each series' y value.
Returns:
A reference to this ToolTip instance for convenient method chaining.
Since:
1.4.0

setValueSuffix

public ToolTip setValueSuffix(String valueSuffix)
Convenience method for setting the 'valueSuffix' option for the tool tips. Equivalent to:

     toolTip.setOption("valueSuffix", " cents");
 
A string to append to each series' y value. Overridable in each series' tooltip options object. Defaults to "".

Parameters:
valueSuffix - The string to append to each series' y value.
Returns:
A reference to this ToolTip instance for convenient method chaining.
Since:
1.4.0

setXDateFormat

public ToolTip setXDateFormat(String xDateFormat)
Convenience method for setting the 'xDateFormat' option for the tool tips. Equivalent to:

     toolTip.setOption("xDateFormat", "%Y-%m-%d");
 
The format for the date in the tooltip header if the X axis is a datetime axis.

Parameters:
xDateFormat - The format for the date in the tooltip header if the X axis is a datetime axis.
Returns:
A reference to this ToolTip instance for convenient method chaining.
Since:
1.4.0

setUseHTML

public ToolTip setUseHTML(boolean useHTML)
Convenience method for setting the 'useHTML' option for the tool tips. Equivalent to:

     toolTip.setOption("useHTML", true);
 
Use HTML to render the contents of the tooltip instead of SVG. Using HTML allows advanced formatting like tables and images in the tooltip. It is also recommended for rtl languages as it works around rtl bugs in early Firefox. Defaults to false.

Parameters:
useHTML - Use HTML to render the contents of the tooltip instead of SVG.
Returns:
A reference to this ToolTip instance for convenient method chaining.
Since:
1.4.0


Copyright © 2015. All Rights Reserved.