简体   繁体   English

Highcharts-如何创建多个y轴并分组数据序列

[英]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. 我想创建一个具有4系列的折线图,并且x轴是日期。 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). 系列中的2个可以使用一个y轴(例如,温度从0到150),另一个2个将使用不同的y轴(例如,CO2含量从0到900)。 I saw the example here for multiple y axis. 我在这里看到了多个y轴的示例。 https://www.highcharts.com/demo/combo-multi-axes 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? 但是,是否有一种方法可以创建一个y轴并将其用于多个数据系列? 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. 可以使用属性yAxis将y轴分配给数据系列定义中的数据系列。

This is the example from Highcharts.com 这是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'
    }

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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