2013-09-22 39 views
1

我需要設置導航器x軸標籤格式程序,但不起作用嗎?是否有爲導航器設置x軸標籤值?如何在高圖中設置導航器標籤格式化程序

請參考下面

navigator: { 
     handles: { 
      backgroundColor: 'white', 
      borderColor: 'red', 
     }, 
     labels: { 
      align: 'center', 
      x: 3, 
      y: 16, 
      formatter: function() { 
       if (((this.value * 4) % 1000) == 0) { 
        if ((((this.value) * 4)/1000) % 5 == 0) { 
         alert("inside"); 
         return (((this.value) * 4)/1000) + "s"; 
        } 
        else { 
         alert("inside else"); 
         return (((this.value) * 4)/1000) + "s"; 
        } 

       } 
       else { 
        return (((this.value) * 4)/1000) + "s"; 
       } 
      } 
     }, 
     enabled: true, 

回答

0

labels選項應該被嵌套在xAxis選項代碼:

navigator: { 
     handles: { 
      backgroundColor: 'white', 
      borderColor: 'red' 
     }, 
     xAxis: { // you are missing this level 
      labels: { 
       formatter: function() { 
        if (((this.value * 4) % 1000) == 0) { 
         if ((((this.value) * 4)/1000) % 5 == 0) { 
          alert("inside"); 
          return (((this.value) * 4)/1000) + "s"; 
         } 
         else { 
          alert("inside else"); 
          return (((this.value) * 4)/1000) + "s"; 
         } 

        } 
        else { 
         return (((this.value) * 4)/1000) + "s"; 
        } 
       } 
      } 
     } 
    } 
+0

在x軸馬克你好,你的答覆。我已經添加感謝標籤,但導航器中的值是基於xaxis計算的,但我想更改導航器中的值。無論如何要更改? – user1127668

+1

您可以準備自己的導航系列,並通過參數http://api.highcharts.com/highstock#navigator.series使用您在全球xAxis和導航器上創建的分離系列。 –

相關問題