Objective Chart : PART I User’s Guide : Chapter 10 User Interaction : Feedback Management
Feedback Management
As described in Chapter 3, “Design Overview of Objective Chart,” the SRGraph object maintains a feedback list (CObList m_FeedbackList) of feedback objects (SRGraphFeedback) that relate graphic objects on screen with the data items that they represent. This feedback mechanism makes data selection, zooming, data dragging, and chart tips possible.
As the SRGraphDisplay object draws data, either as polygons or as points, a record of the area covered by the polygon is kept in a linked list of SRGraphFeedback objects. After the complete chart is drawn, the list of SRGraphFeedback items provides size and shape data for all bars, wigets, pie wedges, points, etc. on screen. The feedback items also provide information that allows each shape on screen to be associated with the data item that created the shape. A simple function call, SRGraph::GetFeedback(), allows the retrieval of a feedback object, if one exists, from under the mouse cursor or from any point on screen.
While this may seem complex at first glance, it has enormous advantages for chart extensions. Any objects that your chart extensions draw may also be logged and associated with data. Therefore, you can use the same method for retrieving information for chart tips or other types of feedback from your custom data shapes as is used for the standard bars and points.
Another class, SRGraphPosition, is used by virtual routines in the SRGraphView class whenever a mouse button up, or drag operation is performed within the area of a data display. SRGraphPosition supplies information on the type of display in which the operation was performed and the style of selection box that should be used to highlight selected areas. The SRGraphPosition supplies the numerical value (in axis scaling) of the point under the mouse cursor. The group and index of the data item at that point and, if possible, a pointer to an SRGraphFeedback item may also be supplied.
The view class can obtain an SRGraphPosition object filled with information about the cursor position (Spoint) by simply calling SRGraphPosition *gp=GetPosition(GetGraph(),Spoint).
NOTE >> The information that SRGraphPosition returns is dependent on the current chart type and axis scaling parameters. If you add non-standard chart or axis types, you might also need to expand the capabilities of the SRGraphPosition object.