com.jinsight.jetchart
Class ToolTip

java.lang.Object
  |
  +--com.jinsight.jetchart.Note
        |
        +--com.jinsight.jetchart.ToolTip

public class ToolTip
extends Note

Tooltips are popup windows displayed when mouse cursor hovers over a series data point. A tooltip displays content associated with a data point, as the corresponding value.

The ToolTip class is instantiated by the GenericGraph class and can only be accessed through a 'get' method implemented in GenericGraph.

The horizontal and vertical coordinates of the mouse cursor are compared against the bounds of a rectangular area surrounding the coordinates of a series data point. Should the cursor is found to be within the rectangular area the tooltip is displayed. This is the default behaviour, but it is also possible to display multiple tooltips simultaneously if a chart displays more than one series. In this case, only one dimension of the rectangular area surrounding a data point is taken into account.
Multiple tooltips are enabled setting the method setMultipleEnabled to true. When tooltips are simultaneously displayed, they are arranged vertically or horizontally, depending on chart orientation, aligned in the center of the chart area and separated by a customizable gap.
3D charts, scatter charts and pie charts do not display multiple tooltips.

See Also:
GenericGraph.getToolTip(), setEnabled(boolean), setMultipleEnabled(boolean), setGap(int)

Field Summary
static int ARROW
          Constant used to define tooltip pointer as an arrow.
static int LABEL
          constant used to set the tooltip content to the respective data point label.
static int LABEL_AND_VALUE
          Constant used to set the tooltip content to the respective data point label and value.
static int LINE
          Constant used to define tooltip pointer as a line.
static int NONE
          Constant used to define tooltip pointer as none.
static int VALUE
          Constant used to set the tooltip content to the respective data point value.
 
Fields inherited from class com.jinsight.jetchart.Note
CENTER, LEFT, RIGHT
 
Method Summary
protected  void finalize()
           
 void setDelay(int delay)
          Sets tooltip delay, in milliseconds.
 void setEnabled(boolean isEnabled)
          Enables/disables tooltips display.
 void setGap(int gap)
          Sets the gap between tooltips simultaneously displayed.
 void setLabel(java.lang.String label)
          Sets a label to prefix tooltip content.
 void setMatchingBorderEnabled(boolean isMatchingBorderEnabled)
          Enables/disables a matching border color.
 void setMultipleEnabled(boolean isMultipleEnabled)
          Enables/disables simultaneous display of tooltips.
 void setPointerColor(java.awt.Color pointerColor)
          Sets tooltip pointer color.
 void setPointerType(int pointerType)
          Sets tooltip pointer type.
 void setTimerEnabled(boolean isTimerEnabled)
          Enables/disables tooltip timer.
 void setType(int type)
          Sets tooltip type.
 
Methods inherited from class com.jinsight.jetchart.Note
setAlignment, setBackground, setBorderColor, setBorderEnabled, setBorderThickness, setBounds, setDraggingEnabled, setFont, setForeground, setLocation, setOpacityEnabled, setShadowColor, setShadowEnabled, setText
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALUE

public static final int VALUE
Constant used to set the tooltip content to the respective data point value.

LABEL_AND_VALUE

public static final int LABEL_AND_VALUE
Constant used to set the tooltip content to the respective data point label and value.

LABEL

public static final int LABEL
constant used to set the tooltip content to the respective data point label.

ARROW

public static final int ARROW
Constant used to define tooltip pointer as an arrow.
See Also:
setPointerType(int)

LINE

public static final int LINE
Constant used to define tooltip pointer as a line.
See Also:
setPointerType(int)

NONE

public static final int NONE
Constant used to define tooltip pointer as none.
See Also:
setPointerType(int)
Method Detail

setEnabled

public void setEnabled(boolean isEnabled)
Enables/disables tooltips display. By default, a tooltip displays the value related to a data point, but it can also display respective label, by setting the tooltip type accordingly. If this method is set to true, all series tooltips are enabled. To disable a series tooltip individually, use the setToolTipEnabled method of the AbstractSerie class.
Parameters:
isEnabled - A boolean value(true/false).
See Also:
AbstractSerie.setToolTipEnabled(boolean), setType(int)

setTimerEnabled

public void setTimerEnabled(boolean isTimerEnabled)
Enables/disables tooltip timer. By default, the tooltip timer is disabled.
Parameters:
isTimerEnabled - A boolean value.
See Also:
setDelay(int)

setDelay

public void setDelay(int delay)
Sets tooltip delay, in milliseconds. The tooltip delay is a time interval before a tooltip pops up. By default, it is set to 500 ms. If the cursor does not move or the mouse button is not pressed, a tooltip pops up at the end of the delay. The minimum delay value is 100 ms.
Parameters:
delay - An integer number.
See Also:
setTimerEnabled(boolean)

setMultipleEnabled

public void setMultipleEnabled(boolean isMultipleEnabled)
Enables/disables simultaneous display of tooltips. If enabled, tooltips are displayed at the center of the chart, vertically or horizontally aligned, if chart is vertical or horizontal, respectively. Multiple tooltips display relies on one mouse cursor coordinates only. Data points of multiple series have their tooltips displayed if their vertical or horizontal coordinates are the same, depending on chart orientation. All series have their data points tooltip area set with the same dimensions, aligned with the labels coordinates. This method has no effect if 3D chart is enabled.
Parameters:
isMultipleEnabled - A boolean value(true/false).
See Also:
GenericGraph.set3DEnabled(boolean)

setLabel

public void setLabel(java.lang.String label)
Sets a label to prefix tooltip content.
Parameters:
label - A string containing tooltip label.

setType

public void setType(int type)
Sets tooltip type. If the tooltip type is set to VALUE, a tooltip only displays a data point value. If it is set to LABEL_AND_VALUE, a data point value and respective chart label are displayed. If it is set to LABEL, only respective data point label is displayed. By default, tooltip type is set to VALUE.
Parameters:
toolTipType - An integer number.
See Also:
VALUE, LABEL_AND_VALUE, LABEL

setPointerType

public void setPointerType(int pointerType)
Sets tooltip pointer type. Default value is ARROW. Tooltip pointer is automatically set to LINE if tooltip opacity is disabled, unless tooltip pointer type is NONE.
Parameters:
pointerType - One of the valid tooltip types.
See Also:
ARROW, LINE, NONE, Note.setOpacityEnabled(boolean)

setPointerColor

public void setPointerColor(java.awt.Color pointerColor)
Sets tooltip pointer color. This method only has effect if tooltip is transparent or pointer type is set to LINE.
Parameters:
pointerColor - A Color object.
See Also:
setPointerType(int), Note.setOpacityEnabled(boolean)

setGap

public void setGap(int gap)
Sets the gap between tooltips simultaneously displayed. If multiple tooltips display is enabled, tooltips are arranged in the center of the chart area, aligned vertically(vertical charts) or horizontally (horizontal charts). There must be a gap between them, to avoid overlapping. Default value is 4 pixels. Minimum value is 1.
Parameters:
gap - An integer number.

setMatchingBorderEnabled

public void setMatchingBorderEnabled(boolean isMatchingBorderEnabled)
Enables/disables a matching border color. If enabled, the tooltip border will match respective series color. Only has effect if tooltip pointer is set to NONE and if the respective series has a legend enabled.
Parameters:
isMatchingBorderEnabled - A boolean value(true/false).
See Also:
setPointerType(int), AbstractSerie.setLegendEnabled(boolean)

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class Note