Using multiple axes

One potential problem when using more than one data series
in a single chart is that if the scales of the data are very different,
the data points might be plotted in very different areas on the
chart’s canvas. For example, one stock price could trade in the
range of $100 to $150, while another stock price could fluctuate
from $2 to $2.50. If you plot both stocks in the same chart, it
would be difficult to see any correlation between the prices, even
with a logarithmic axis.

To work around this problem, you can use multiple axes in your
charts so that each data series is positioned relative to its own
axis. All chart controls that are subclasses of CartesianChart support
adding additional sets of data on a additional scales in the horizontal
axis, vertical axis, or both. (This applies to all charts except
the PieChart control.)
You can use values on the additional axes to compare multiple sets
of data that are on different scales, such as stock prices that
trade in different ranges.

The following example shows a stock price that trades within
a $40 to $45 range, and another stock price that trades within a
$150 to $160 range. The values of the axis on the left show the
range of values of the first stock, and the values of the axis on
the right show the range of values of the second stock.

To use multiple axes in a chart, you first define the chart’s
series and their axes. For example, for a chart that mixes columns
with a line, you would have a ColumnSeries and LineSeries. For each
of these, you would likely also define the vertical axis, as the
following example shows:

Note that you control the location of the axis by using the placement property of
the AxisRenderer. For vertical axis renderers, valid values are left and right. For
horizontal axis renderers, valid values are top and bottom.

Axes can be independent of the series definition, too. For example,
you can also point more than one series to the same axis. In this
case, you could define a horizontal axis, as follows:

Even if the verticalAxisRenderers or horizontalAxisRenderers properties
have not been specified, Cartesian charts will create default horizontal and
vertical axis renderers based on the default axes of the chart.

When using multiple axes, it is important to recognize that it
will not necessarily be immediately apparent which axis applies
to which data set in the chart. As a result, you should try to style
the axes so that they match the styles of the chart items.

The following example defines two colors and then uses those
colors in the axis renderers and in the strokes and fills for the
chart items:

You can customize labels by using the labelFunction property
of the AxisRenderer class. This lets you control the labels if you
use multiple axes. For more information, see Customizing axis labels.

For CartesianChart controls, there is no limit to the number
of axes you can have.

For PolarChart controls, such as a PieChart, you generally do
not use multiple axes because even though each series could have
its own angular axis, the angular axis is always from 0 to 360 (the
size of the wedge).

Twitter™ and Facebook posts are not covered under the terms of Creative Commons.