shengloong
shengloong

Reputation: 85

Second yAxis does not scale according to series in Highcharts

I have created a Highchart in which there are two y-axes. My problem is the second yAxis (on the opposite side) does not scale according to the series which I have specifically attach to it in the options (yAxis: 1).

http://jsfiddle.net/sushengloong/MMwSv/

In the jsfiddle above, it's obvious that the Price axis has much bigger extreme as compared to the two line series. This makes the two line series look much flatter.

When I take away Price 1 series by clicking on the legend, yAxis can then scale correctly based on Price 2 series but not the other way round. This is really strange and I am not sure if I have missed out anything.

Upvotes: 2

Views: 4852

Answers (1)

Paweł Fus
Paweł Fus

Reputation: 45079

Set alignTicks: false, see: http://jsfiddle.net/MMwSv/2/

From docs:

alignTicks: Boolean

When using multiple axis, the ticks of two or more opposite axes will automatically be aligned by adding ticks to the axis or axes with the least ticks, as if tickAmount were specified.

This can be prevented by setting alignTicks to false. If the grid lines look messy, it's a good idea to hide them for the secondary axis by setting gridLineWidth to 0.

If startOnTick or endOnTick in an Axis options are set to false, then the alignTicks will be disabled for the Axis.

Disabled for logarithmic axes.

Defaults to true.

Upvotes: 9

Related Questions