wilhelm kurz software

home
application notes

dynaplot application notes

stacking

How to align plot areas in stacked charts

Problem

Sometimes it is required to visualize several related parameters (y-values) over a common abscissa. We can use one chart for each output parameter and place the charts in a column on our form or page. To be able to compare results it is then desirable that the plots in the respective charts are aligned and all the same size. If the charts have different scale limits and with automatic labeling enabled this is generally not the case, however. Regard the example screenshot below. 

Although the limits for the abscissa of both charts are the same, the plot areas are not aligned. This is because the limits of the ordinate are different in both charts and in the lower chart the plot area has to be moved to the right to reserve more space for the longer annotation texts.

Solution

With DynaPlot3 there is a very simple solution for this problem which requires only on line of code.

Private Sub Form_Load()
    DynaPlot2.Axes.XAxis.Synchronize DynaPlot1.Axes.XAxis, True
End Sub

Apart from making the left and right margins equally wide for both controls. The scale bounds of the horizontal axes are kept in synch so that gridlines in both charts always align. Also, if you pan one chart the other chart will be panned too.

Another possibility, of course, is to plot both curves in one plot with two y-axes.

   

[home] [products] [news] [contact] [links]