Dual Axis in Highstock?

2019-07-20 04:57发布

问题:

Is there any way to make a Dual Axis in Highstock like this one on Highcharts?

http://www.highcharts.com/demo/combo-dual-axes

回答1:

It looks like you can do it the same way as in highcharts. Each series specifies yAxis:n where n is the axis you want to plot it against, and you need to define n yAxis entries. I modified one of the example highstock demos: http://jsfiddle.net/ykfmG/

$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename='+ name.toLowerCase() +'-c.json&callback=?',   function(data) {

        seriesOptions[i] = {
            name: name,
            data: data,
            yAxis:i
        };
}



        yAxis: [{
            labels: {
                formatter: function() {
                    return (this.value > 0 ? '+' : '') + this.value + '%';
                }
            },
            plotLines: [{
                value: 0,
                width: 2,
                color: 'silver'
            }]
        },{opposite:true},{opposite:true},{opposite:true}],