2016-11-02 60 views

回答

0

在第一個軸上設置極值後,可以手動設置第二個軸的極值。

xAxis: [{ 
    type: 'datetime', 
    minRange: 24 * 3600000, // 1 day 
    labels: { 
     align: "left", 
     rotation: 45 
    }, 
    dateTimeLabelFormats: { 
     day: '%e %b %Y' 
    }, 
    events: { 
     afterSetExtremes: function (e) { 
     this.chart.xAxis[1].setExtremes(e.min, e.max, true, false); 
     } 
    } 
    }, 

例如:https://jsfiddle.net/t9ug4pm7/9/

您也可以連結的兩個軸,所以連接軸極端將主軸後跟隨。但是對於列,需要定義pointRange,因爲沒有它,列可能會被錯誤地繪製。

, { //axis 
     type: 'datetime', 
     linkedTo: 0, // linked to master axis 
     minRange: 24 * 3600000, 
     lineWidth: 0, 
     tickWidth: 0, 
     labels: {enabled: false}, 
     opposite: true 
    } 

series: [{ 
     id: 'daily', 
     name: 'Daily', 
     type: 'column', 
     color: 'rgb(124, 181, 236)', 
     data: data['daily'], 
     pointRange: 1000 * 3600 * 24, 
     }, 

例如:https://jsfiddle.net/t9ug4pm7/11/

相關問題