Herbert
Posts: 4
Joined: Mon Sep 06, 2010 3:09 pm

Strange scaling for opposite yAxis

Would like to have identical scales on the left and right yAxis. But as soon as the difference of the only two y values is less then 50,
the scale on the right side is wrong (compared to the y value). Any help is highly appreciated. Thanks in advance!

Code: Select all

var chart = new Highcharts.Chart(
  {
    chart: {
      renderTo: 'container',
      defaultSeriesType: 'line'
    },
    xAxis: {
      type: 'datetime'
    },
    yAxis: [
      { // primary yAxis
      },
      { // secondary yAxis
        linkedTo: 0,
        opposite: true
      }
    ],
    plotOptions: {
      series: {
        dataLabels: {
          enabled: true
        }
      }
    },
    series: [
      {
        animation: false,
        // data: [{x:1275049200000,y:1},{x:1275563559000,y:51}]  // right
        data: [{x:1275049200000,y:2},{x:1275563559000,y:51}]  // wrong
      }
    ]
  }
);
torstein.honsi
Site Admin
Posts: 9215
Joined: Thu Nov 09, 2006 11:22 am
Location: Vik i Sogn, Norway

Re: Strange scaling for opposite yAxis

Thanks for reporting, this is a bug. I've logged it at http://github.com/highslide-software/hi ... s/issue/84. Will address it as soon as possible.
Torstein Hønsi
CTO, Founder
Highsoft
Herbert
Posts: 4
Joined: Mon Sep 06, 2010 3:09 pm

Re: Strange scaling for opposite yAxis

Modified the example (see http://jsfiddle.net/CsTun/2/) to show the correct and the wrong chart.
Hint:
I recognized, that the odd beahiour of the opposite yAxis scaling is somehow dependent on the
containers height. If the container's height is between 399px and 475px (both values included),
the opposite scale is computed incorrect, outside this band it is fine. But I did not test other y values
in combination with the container's height.
However, odd is the fact, that the left scale is always correct.
torstein.honsi
Site Admin
Posts: 9215
Joined: Thu Nov 09, 2006 11:22 am
Location: Vik i Sogn, Norway

Re: Strange scaling for opposite yAxis

The issue is caused by the slave axis adding padding and rounding on top of what is already done on the master axis. Check out http://jsfiddle.net/CsTun/3/ for a partly valid workaround.
Torstein Hønsi
CTO, Founder
Highsoft
Herbert
Posts: 4
Joined: Mon Sep 06, 2010 3:09 pm

Re: Strange scaling for opposite yAxis

Thanks for providing a workaround!
Any idea when a real fix will be available?
torstein.honsi
Site Admin
Posts: 9215
Joined: Thu Nov 09, 2006 11:22 am
Location: Vik i Sogn, Norway

Re: Strange scaling for opposite yAxis

We will try to get it fixed before the next maintenance release.
Torstein Hønsi
CTO, Founder
Highsoft

Return to “Highcharts Usage”