On April 27, 2024, our Sign-in and Create Account options will be unavailable from 9am-12pm ET. During this maintenance window, developer account access and free trial registration will be unavailable.

Making the scales of a dual-axis chart the same

pricher
edited 2013 01 in DevShare Downloads #1
When generating a dual-axis chart, the scale of each axis is determined by the low and high values of the series contributing to each axis. Although this behaviour makes sense, in some cases it is desirable to have the same scale for both axes even though the values may differ in range.<br />
<br />
It is possible to change the scale of each axis independently using the chart wizard; however, if we don't know in advance the range of values that can be charted, this is not sufficient.<br />
<br />
A bit of Java scripting using the chart API can resolve the problem. In this example, we override the beforeGeneration method of the chart onRender event. First, we get the low and high values for the two series. Secondly, we round up to the top value. Finally, we apply set the min and max values of the scale to each axis.<br />
<br />
Thanks to Scott Rosenbaum for providing the original Java Event Handler example.<br />
<br />
P.