By default, the graph registers a callback for ToolTips, which provides ToolTip text to the underlying graph engine. In most graphs, when the mouse pointer is over a component that represents data, the graph displays the data value that the component represents, as well as the labels that identify the group and the series to which the component belongs. In a scatter, bubble, or stock market graph, the graph displays each of the values that the marker represents.
When the mouse pointer is not positioned over a component that represents data, the graph does not display a ToolTip.
The following properties of the Graph
class control the display of ToolTips.
Property |
Description |
---|---|
|
Whether ToolTips are displayed for markers, and if so, the kind of information that appears
in the ToolTips: the data value, the cumulative data value (stacked graphs), the percent of the
group value (pie graphs), or information about the group or series to which the data belongs.
Except for |
|
Whether group information appears in ToolTips, and if so, the kind of information that appears in the ToolTip: the dimension name and the dimension member, or only the dimension member. |
|
Whether series information appears in ToolTips, and if so, the kind of information that appears in the ToolTip: the dimension name and the dimension member, or only the dimension member. |
|
The number of milliseconds between the time that the mouse stops moving and the time that the ToolTip appears. |
The following code sets the ToolTips so that they display the data value that the marker represents and the group to which the marker belongs. For group information, the ToolTip will display the dimension (such as "Product") the dimension member (such as "Shoes").
graph.setMarkerTooltipType((Graph.MTT_VALUES | Graph.MTT_TEXT)); graph.setSeriesTooltipLabelType(Graph.TLT_NONE); graph.setGroupTooltipLabelType(Graph.TLT_DIM_MEMBER);
If you want to display information other than information about the data value and the group
and series to which the data belongs, then you can write your own callback, which can provide
any text that you want in the ToolTip. The CustomToolTipCallback
interface
specifies a single method, getToolTipText
, which you can implement.
The graph calls this method and displays the text from this method in the ToolTip.
The getToolTipText
method takes two arguments:
defaultToolTipText
-- The text that the graph would display without your custom
callback
componentHandle
-- A subclass of the ComponentHandle
class, which
identifies the kind of object that the mouse is over
You implement getToolTipText
and use the information from the
ComponentHandle
to specify text that you want to display in the ToolTip.
If you implement the CustomToolTipCallback
interface, then you register the
customized callback by calling the setCustomToolTipCallback
method of the
graph.