SVGGraph dual and multiple Y-axis graphs
Sometimes one Y-axis just isn't enough. Starting in version 2.15, SVGGraph supports drawing a second axis on the right hand side of several of the graph types to show a different scale.
SVGGraph 2.27 adds support for drawing multiple Y-axes using the same option.
Enabling the second axis
Figure 1 below demonstrates what happens when you try to plot two different series of values on one grouped bar graph when the values in one series are orders of magnitude greater than the other. There are green bars in between the orange bars, but their height is less than a pixel so they cannot be seen.
Figure 2 above shows the effect of setting the
option to an array containing the values 0 and 1. The values in the array set
the axis for each dataset in turn, 0 being the left axis and 1 the right - so
the first dataset will be shown on the left, the second on the right.
It is not very clear from figure 2 which axis goes with which group of values, so to make it easier to indicate which is which, SVGGraph supports supplying an array to the axis styling options with an entry for each of the individual axes. Figure 3 shows the same graph with the Y axes and text labels coloured to match the bars.
Figure 4 above shows a multi-line graph instead of the grouped bar graph, with added axis labels.
dataset_axis option is supported by all the vertical
multi-dataset graphs apart from the stacked types. The stacked bar and line
dataset_axis for line datasets, but not for the
Sometimes two Y-axes are not enough - so from version 2.27 of SVGGraph you can actually have as many axes as will fit on the graph:
Multiple Y-axes uses the same
dataset_axis option for specifying
the axis to use, but instead of just 0 and 1 you can use any number of axes.
The axes on the right of the graph start at 1, then continue with axis 2, axis 3
and so on. The axis numbers must be consecutive or SVGGraph will end up with an
empty axis (which it won't be able to draw and you'll get the “Zero-length
There is one extra option available when multiple axes are used,
axis_space”. This is the amount of space added
between each axis on the right side of the graph (and is added on top of the
other axis spacing options).
Listed below are all the options that are tagged multi-axis in the options index. These are all the options that have some relevance to multiple axes - the links will take you to the description page for each option.
axis_right is in the list above, but the option does
nothing when multiple axes are enabled.