简体   繁体   中英

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

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 (eg, temperature from 0~150) and the other 2 will use a different y axis (eg, 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!

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'
    }

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM