Highcharts - how to create multiple y axis and group the data series

580 views Asked by At

I want to create a line charts with 4 series and the x axis is the date. 2 of the series can use one y axis (e.g., temperature from 0~150) and the other 2 will use a different y axis (e.g., CO2 level from 0 ~ 900). I saw the example here for multiple y axis. https://www.highcharts.com/demo/combo-multi-axes

But is there a way to create one y axis and use it for more than one data series? Thank you very much!

1

There are 1 answers

0
user1172455 On

Just found the way - posted this question too fast :)

One can assign the y axis to a data series in the data series definition, using the property yAxis.

This is the example from Highcharts.com

{
    name: 'Sea-Level Pressure',
    type: 'spline',
    yAxis: 2,
    data: [1016, 1016, 1015.9, 1015.5, 1012.3, 1009.5, 1009.6, 1010.2, 1013.1, 1016.9, 1018.2, 1016.7],
    marker: {
        enabled: false
    },
    dashStyle: 'shortdot',
    tooltip: {
        valueSuffix: ' mb'
    }

}