Current Uses of Compound Components
Both of the principles mentioned above are used in the classes SRGAxisManager and SRGCompoundDisplay, both of which are derived from SRGCompoundComponent.
SRGCompoundDisplay holds four SRGAxisManager components. It creates these components automatically upon instantiation and so demonstrates the first principle. The individual axis managers correspond to the top, left, bottom, and right sides of the display rectangle. SRGCompoundDisplay automatically positions the axis managers so that they correspond with the four sides of the rectangle. Each axis manager is therefore responsible for the display of one axis. SRGCompoundDisplay not only encapsulates the axis managers but also dictates certain preset behavior. Axes on opposing sides of the chart may be locked to a preset numerical relationship. This is useful for creating scale conversion charts like the millimeter - inches chart in the ChartEx sample program.
The SRGAxisManager illustrates the second principle because it can optionally be given sub-components that contribute to the overall output of the compound chart. When they are created, the axis managers hold a list of dumb components that do nothing and display no data. You may programmatically add components that display scales, tick marks, grid lines, and data displays and components that monitor data values. Because the items are held on the component list of the SRGAxisManager, they are accessible to code that is external to the axis manager (and also external to the compound display). Therefore you can change a component’s style or even replace a complete sub-component with another while the program is in progress.