Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Objective Chart User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

10.4 Chart Tips

Similar in appearance to a ToolTip window, the SRGraphTip or chart tip is invoked by the SRGraphView class to provide feedback about chart data items. Figure 127 shows a view and a chart tip in action.

Figure 127: Chart tips in action

10.4.1 Using Chart Tips

Whenever the mouse pointer remains stationary for 1.5 seconds, SRGraphView::OnTimer() is called. OnTimer() checks to see if the mouse pointer is on a data item— that is, if the mouse's point on the screen is contained in any of the regions stored in the SRGraphFeedback objects in the feedback list. If the mouse pointer is on a data item, OnTimer() calls ShowFeedback().

ShowFeedback() uses the information in the SRGraphFeedback object to access the indicated data item. It obtains additional information by creating an SRGraphPosition object. Depending on the chart type returned by SRGraphPosition, ShowFeedback() formats a CString object containing relevant information about the data object.

The Objective Chart view classes contain a member variable of type SRGraphTip, which is based on CWnd. ShowFeedback() passes its text string to the graph tip window. The graph tip window displays the text near the data item until the mouse pointer moves, or until five seconds pass. Then the chart tip window is destroyed. The SRGraphTip displays the text using the system font.

10.4.2 Customizing Chart Tips

10.4.2.1 Changing the Text in Chart Tips

By default, chart tips display the data item's value, group, and index, if available, depending on the chart type. To change the format or content of the displayed text, override the ShowFeedback() function in your view class (derived from SRGraphView or SRGScrollView). A sample is shown below.


Chart tips can now display multiple lines of text. The new line character (\n) serves as a line separator.

10.4.2.2 Changing the Appearance of Chart Tips

To change the chart tip text color and the background color, use the member functions SetTextColor() and SetBKColor().

10.4.2.3 Changing the Delay Time for Displaying Chart Tips

The OnMouseMove() function in the Objective Chart view classes kills and resets a special timer event. Thus, after the mouse remains stationary (no mouse move events) for a specified time interval (default=1.5 seconds), the timer event occurs. The OnTimer() handler kills the timer and calls ShowFeedback() to display a chart tip.

To change the delay time for displaying chart tips, override the OnMouseMove() function of the view class and change the parameter of SetTimer().

The SRGraphTip::ShowTip() function sets another timer that determines how long the chart tip is displayed. After the specified time interval (default=5 seconds), OnTimer() calls EraseTip(), which destroys the chart tip window. SRGraphTip::OnMouseMove() also destroys the chart tip window when the mouse is moved.

10.4.2.4 Changing a Chart Tip's Maximum Display Duration

SRGraphTip now has a SetTipTime() function that you can use to change the SetTimer() parameter in ShowTip(). To change the maximum duration that a chart tip is displayed, call SetTipTime() for the m_GraphTip member of the view class from OnInitialUpdate() or ShowFeedback(). For example,



Previous fileTop of DocumentContentsNo linkNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and Stingray, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.