2012-09-04 28 views
0

我使用Highstock,我將通過點擊事件來設置xAxis.plotLine的值。我怎樣才能做到這一點,直接顯示? 我使用xAxis.plotLines.value = this.x設置了單擊事件的值;設置xAxis.plotline的值live highstock

series : [ 
     { 
    xField : 'deltaTime', 
    yField : 'variableOne' 
    },{ 
    xField : 'deltaTime', 
    yField : 'variableTwo', 
    }], 
    chartConfig : {   
     xAxis: { 
     plotLines: [{ 
      width: 2, 
      color: 'black' 
     }] 
    }, 
    rangeSelector : { 
     selected : 1 
    }, 
    plotOptions: { 
      series: { 
       cursor: 'pointer', 
       point: { 
        events: { 
         click: function() {       
         var hcConfig = Chart.ux.HistoryChart.getConfig('single_line'); 
         hcConfig.chartConfig.xAxis.plotLines.value = this.x; 
         } 
         } 
        } 
       }, 
       marker: { 
        lineWidth: 1 
       } 
      } 
     }, 
    } 
} 

回答

0

添加情節主線創建圖表後,你必須調用圖表的X軸對象的addPlotLine方法。您可以訪問從傳遞到您的單擊處理event參數:

point: { 
    events: { 
     click: function(event) { 
      event.point.series.xAxis.addPlotLine({ ... }); 
     } 
    } 
} 
+0

感謝您的幫助 – dascoco

+0

@dascoco很高興我可以幫助和歡迎SO。如果這回答了您的問題,請單擊左側的綠色箭頭以確認答案。 – JohnnyHK