Graph Classes
Objective Chart operations are all encapsulated in one class, SRGraph. An object of this class may be used as a member variable in another class, as a local variable in a particular function, or as a global variable. This object contains and controls the working parts of the Objective Chart system in a series of linked lists — a data list, a list for visual components, and a list that optionally contains data for user feedback.
A derived class, SRDynamicGraph, is a substitute for SRGraph that allows alternative data storage models to be used. The Dynamic data storage model stores the data values in simple arrays instead of the internal list of data objects. It is useful when large amounts of data are to be plotted and when the individual styles and annotations of the data objects are not needed. The Structure data storage model can access data values stored in external (to the graph object) memory buffers. The only requirement is that the data values to be plotted in a series be uniformly spaced in memory.
The illustration below shows the hierarchy for the Objective Chart graph classes. In the hierarchy diagrams in this manual, the standard MFC classes from which the Objective Chart classes are derived are shown in white boxes.
Figure 4 – Basic graph class hierarchy
SRGraph holds and manages the data used in the Objective Chart system. This data is split into three sections and managed by three separate lists: the data list, the component list, and the feedback list.
*The data list. This list holds the two-dimensional data array. The data list is actually a member (m_data) of SRGraph's helper class or data manager. It can be accessed by calling SRGraph::GetDataList().
*The component list. The list managed by m_ComponentList holds all the graphic items that make up the various display parts. This list may be as simple as a single chart or may contain a complex list of backgrounds, titles, labels, legends, and multiple display.
*The feedback list. Managed by m_FeedbackList, this list of feedback objects is optionally updated every time the chart is drawn. The feedback objects keep a record of the polygonal shapes that have been drawn and the data items that they represent. This feature establishes a screen-position to data item relationship. You can interrogate the data values in the chart by positioning the mouse cursor over a chart bar or graph symbol.
SRGraph also holds a text string (actually an annotation list), m_ Title, that is displayed by the optional title component as the chart title.
Figure 5 shows the relationships of the various lists.
Figure 5 – SRGraph block diagram
SRDynamicGraph is an alternative to SRGraph that supports a different data storage scheme. SRDynamicGraph is the data manager for Dynamic and Structure data.
Briefly, the Dynamic data storage model stores data in a contiguous block rather than in a list of discrete data objects. This arrangement reduces the storage space required and allows quick access to the data memory through pointers.
In the Structure data storage model, the chart accesses data in a pre-existing memory block, external to the Objective Chart classes. The basic requirement is that the data values to be plotted must be uniformly spaced within the memory block. Various basic data types are supported.
SRDynamicGraph overrides certain SRGraph data access functions to make it appear to the component system displaying the data that the values actually come from the discrete list. The drawing system accesses Standard, Dynamic, and Structure data in the same way.
Note that the description here specifically does not use the term “static data” when referring to the linked list storage. The lists are still easily changeable, just slower to access.
NOTE >> SRGraph handles all three data storage models via one of its constructors. SRDynamicGraph is no longer required and is deprecated, although it is still provided for backward compatibility only. Please refer to the "SRGraph Class Overview" section in Objective Chart's Class Reference for further details.
Data Managers
SRGraph and SRDynamicGraph defer all data access functions to their associated data managers, SRGDataManager or SRGDynamicDataManager. This level of indirection makes it easier to override the data access functions without customizing SRGraph itself. Also, it is possible to share a data manager and the data that it maintains between two or more charts.
SRGDataManager supports all three data storage models. SRGDynamicDataManager is customized for the Dynamic and Structure data storage models only.