Using a Data Watcher
One or more data watchers can be used with a standard SRGraphDisplay. The data watcher finds the first display component after it in the component list. The data watcher obtains the data scope and other information from this display.
When used in conjunction with a compound display (as described in Chapter 18 Compound Component System ), the SRGDataWatcher is registered with and managed by an SRGAxisManager object. Then the data watcher uses information from the display component of the same axis manager.
The data watcher can draw a line (or lines) on the graph indicating the limit level(s). Because SRGDataWatcher is derived from SRGGridLines, the appearance of its line(s) can be modified in the same way as grid lines.
Note: Currently the data watcher fully supports only charts with one group per series. For other chart types, only the data values in the first group can be scanned. Use SetScope() and SetGroupStep() to limit the data objects to be scanned.
Note: Currently the data watcher does not correctly draw lines on displays with logarithmic axes.
To set up a typical data watcher with a standard display:
SRGDataWatcher *pDW=new SRGDataWatcher;
// set condition and limit values
pDW->SetScanType(CX_SCAN_OUTOFBRACKET);
pDW->SetHighLimit(25.4*120); // Ten feet in mm
pDW->SetLowLimit(25.4*36); // Three feet in mm
// use following display’s scope
// instead of all the data in SRGraph list
pDW->SetLinkToDisplay(TRUE);
pDW->SetVisible(TRUE); // draw limit lines
// set number of groups per series, if more than 1
pDW->SetGroupStep(2);
mGraph.AddComponent((SRGraphComponent*)pDW);
// the display must follow
SRGraphDisplay* pD = new SRGraphDisplay;
To set up a data watcher in a compound display, see the CChart example in Chapter 18 Compound Component System






