2014-02-18 60 views
0

我如何顯示/隱藏第二y軸我試圖使我的高位代碼功能化,並且我正在努力理解如何根據條件if語句繪製第二個y軸,例如下面的代碼:highcharts - 基於可選參數

yAxis: [{ // Primary yAxis shown for all charts 
       min: 0, 
       labels: { 
        format: '{value} pcks ', 
        style: { 
         color: '#4572A7' 
        } 
       }, 
       title: { 
        text: 'Volume', 
        style: { 
         color: '#4572A7' 
        } 
       } 
      }, { // Secondary yAxis make this optional based on AxisNum accepted values:1/2 
       formatter: function(){ 
        if(AxisNum === 2]) 
        { 
         gridLineWidth: 0, min:0, title: { text: 'Cycle Time', style: { color: '#C88622' } }, labels: {format: '{value} days',style: {color: '#C88622'}},opposite: true; 
        } 
       } 

      }], 

回答

1

您可以使用哪些檢查AxisNum條件,然後準備對象正確的Y軸和選項,你將使用

yAxis: yAxisCustomised 

http://jsfiddle.net/92u9M/1/

+0

臨屋你這樣做了! – k7hulu