Objective Chart User’s Guide : PART II Programmer’s Guide : Chapter 24 Chart Combinations : Overlaying Displays
Overlaying Displays
In addition to aligning multiple displays in a window, SetDisplayRect() can be used to place one display directly on top of another. The displays can use the same or different axis scalings.
NOTE >> The Compound Display system simplifies the drawing of two overlaid displays with associated axes.
The SyncDisp(lay) sample project demonstrates how three displays can be overlain and set to use the same scaling parameters. In CSyncdispView::OnInitialUpdate(), the three displays are created and configured. The first display is the master, which controls and draws the axes. The other slave displays are instances of a special display class. The Draw() member of this class searches the component list for the first display component and copies the display rectangle and scaling parameters from the master. The axis style of the slave displays is set to CX_AXIS_NONE, because the axis only needs to be drawn once— by the master display.
NOTE >> The Freestyle graph type supports a variety of data styles (bars, wigets, lines, etc.) on a classic axis. Overlaid displays with the same scales are only required for those combinations (e.g. Stacked VBar and Line) that are not supported by Freestyle.
NOTE >> Support for zooming in overlaid displays can be complicated, depending on the graph type.
Overlaid displays do not have to use the same scaling. The compound display can easily handle two independent displays. For more than two displays, a question is how to indicate the scaling of more than two axes— additional free standing axes, superimposed axes in various colors. These considerations are application specific, so they are not addressed here. At a minimum, a custom axis type and a method to allocate space for the additional axes are required.