Highstock,多系列图表,独立xAxis

时间:2015-07-22 15:33:40

标签: javascript highcharts highstock

以下是我的图表, 我想根据数据输入为这两个图表添加xaxis,

我应该在哪里进行更改或添加xaxis,以便我可以定义xaxis的最小最大限制。

这里是小提琴:http://jsfiddle.net/pratik24/n24s2fyk/3/

代码:

$(function () {  
        $('#container').highcharts('StockChart', {

            navigator:{
                enabled: false
            },
            scrollbar:{
                enabled: false
            },

             rangeSelector : {
                selected : 1,
                 enabled:false
            },


            yAxis: [{
                  min: -1e6,
                max: 1e6,
                labels: {
                    align: 'left',
                    format : ''
                },
                title: {
                    text: 'OHLC'
                },
                height: '30%'
            }, {   min: -1e6,
                max: 1e6,
                labels: {
                    align: 'left',
                    x: -3,
                    format : ''
                },
                title: {
                    text: 'Volume'
                },
                top: '65%',
                height: '35%',
                offset: 0
            }],

            series: [{
                inverted: true,
                type: 'scatter',
                name: 'AAPL',

                data: [7.0, 6.9, 9.5, 14.5, 18.4],
                yAxis: 0
            }, {
                inverted: true,
                type: 'scatter',
                name: 'Volume',
                data: [3,6,8,5,2],
                  yAxis: 1

            }]
        });

});

提前致谢,

1 个答案:

答案 0 :(得分:1)

以下是解决方案:

  [http://jsfiddle.net/pratik24/uga37ox0/2/][1]

  [http://jsfiddle.net/uga37ox0/1/][1]
感谢来自highcharts suppot团队的人员

 xAxis: [{

            },{
            offset: -245,
            min: 0,
            max: 10
        }],
   series: [{
                inverted: true,
                type: 'scatter',
                name: 'AAPL',
                data: [7.0, 6.9, 9.5, 14.5, 18.4],
                yAxis: 0,
                xAxis: 1
            }, {
                inverted: true,
                type: 'scatter',
                name: 'Volume',
                data: [3,6,8,5,2],
                yAxis: 1,
                xAxis:0

            }]