Highcharts - Problem with negative values โ€‹โ€‹when displaying multiple axes

We are trying to display two series of data in one diagram. The first series (i.e. the Number of quotes) can contain only positive integers (and 0). The second series (that is: sales value) can contain both positive and negative floating point values โ€‹โ€‹(in case you are interested, negative values โ€‹โ€‹result from the issue of credit notes).

As indicated in the attached image, the problem is that when the second series contains negative values, the 0-point โ€œbaselineโ€ of the two data series is no longer separated.

a busy cat

We tried to set the "min" options of the Y axis to 0, but then we lose our understanding of negative values.

We also tried to set the minimum value for the first series equal to the minimum extreme of the second series, but, unfortunately, this does not scale the columns very well (since the values โ€‹โ€‹of each Y axis are completely different scales, that is: 10s versus 1000s).

How can we customize the chart so that the 0-point baseline is shared? In other words, how would we run the blue columns on the same baseline as the green dot 0?

Update

Linger is a step in the right direction. Installing minboth tickintervalfor both axes does the trick. However, the values โ€‹โ€‹should be determined dynamically based on the variable data in which I am now stuck.

Any hints on how these values minand tickintervalcan be determined before I generate the chart?

. , (/), . , (/), , . , highcharts , , , , ( ):

var factor = right_axis.min / right_axis.tickinterval;

left_axis.min = factor * left.tickinterval;

. , API setExtremes() Axis, , . , . , - ?

.

+5
1

, , tickInterval min yaxis, jsfiddle.

XML , , . , , . if . .

Low less than -50 and greater -90
With High less than 400
Primary Axis: min: -2, tickInterval: 1,
Secondary Axis: min: -100, tickInterval: 50

Low less than -50 and greater -90
With High greater than 400
Primary Axis: min: -1, tickInterval: 1,
Secondary Axis: min: min: -100, tickInterval: 100,

, , min tickInterval. tickInterval 1.

+3

All Articles