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:

axis_colour_vaxis_stroke_width_vaxis_font_vaxis_font_size_v
axis_font_adjust_vaxis_text_space_vaxis_text_colour_vaxis_text_position_v
axis_text_angle_vdivision_style_vdivision_size_vdivision_colour_v
subdivision_style_vsubdivision_size_vsubdivision_colour_vaxis_max_v
axis_min_vlog_axis_ylog_axis_y_baseminimum_grid_spacing_v
grid_division_vsubdivision_vminimum_units_yunits_y
units_before_ylabel_vlabel_colour_vlabel_font_v
label_font_size_vlabel_font_weight_v

« Back to top of page Titles and axis labels »