SVGGraph dual Y-axis graphs

« Return to SVGGraph page

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.

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 1
default settings
Figure 2
dataset_axis = array(0, 1)

Figure 2 above shows the effect of setting the dataset_axis 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 3
axis_text_colour_v = array('#930', '#390')
axis_colour_v = array('#930', '#390')
Figure 4
label_v = array('Sales', 'Ages')
label_colour_v = array('#930', '#390')

Figure 4 above shows a multi-line graph instead of the grouped bar graph, with added axis labels.

Currently, the dataset_axis and per-axis styling options are supported by these graph types: MultiLineGraph; MultiScatterGraph; GroupedBarGraph; GroupedBar3DGraph; GroupedCylinderGraph.

The options that support per-axis values are shown in the table below:


« Back to top of page Titles and axis labels »