2014-01-17 61 views
0

我正在使用使用兩個Y軸和兩個X軸的Stockchart圖。當我在rangeSelector上設置selected達到某種高度時,它工作正常。但是如果需要削減一些月份,那麼兩個x軸就會錯位。上面的兩條線圖似乎在圖的外部開始。Highcharts:多軸上未對齊的日期

小提琴:http://jsfiddle.net/gn393/5/(具有selected設定得高,對準)

小提琴:http://jsfiddle.net/gn393/6/(具有selected設置爲低,不對準)

在下部x軸的線圖不改變在上述變焦時例子。我使用afterSetExtremes。但是這個問題在上面的小提琴中仍然是可重現的。

yAxis: [{ 
    height: 420, 
    lineWidth: 2, 
}, { 
    top: 500, 
    height: 210, 
    lineWidth: 2, 
}], 
xAxis: [{ 
    type: 'datetime', 
    opposite: true, 
    offset: -700, 
},{ 
    type: 'datetime', 

    offset: -200, 
}], 

回答

1

如果你有兩個xAxis,你需要渲染按鈕並調用兩個動作的setExtremes函數。因爲按鈕僅適用於第一個xAxis。第二個解決方案是使用afterSetExtremes並在第二個xAxis上調用setExtremes。

編輯: http://jsfiddle.net/gn393/8/

xAxis: [{ 
        type: 'datetime', 
        opposite: true, 
        offset: -700, 
        events:{ 
         afterSetExtremes:function(){ 
          var min = this.min, 
           max = this.max, 
           chart = this.chart; 

          chart.xAxis[1].setExtremes(min,max); 

         } 
        }, 
       },{ 
        type: 'datetime', 

        offset: -200, 
       }], 
+0

但兩個都不選小提琴的我用'setExtremes'功能。儘管如此,我能夠重現相同的行爲。 –

+0

查看我的更新回答。 –

+0

在你的小提琴中,爲什麼xAxis會關閉一個月?爲什麼兩個yAxis在不同的位置顯示? –