2017-06-28 2 views
0

私は、複数の凡例を持つ散布図+プロット線グラフを作成しています。散布図の値に基づいてプロット線の値を変更する必要があります。凡例アイテムをクリックすると散布図の値を取得するのに誰も助けてくれますか?Highcharts Legendイベントクリックしてデータを取得

私は凡例をクリックすると警告が表示されます。次に、私は散布値を取得し、プロット線グラフ

events: { 
       legendItemClick: function(e) { 
        if(this.visible) { 

         alert('visible'); 


        } 
        else { 
         console.log("result"+result); 
         alert('Not visible'); 

        } 
       } 
      }, 
+0

サンプルをライブデモとして複製できますか?それはその一部のように見えますが、私たちはこの事件を再現することができません。 –

+0

series.update()や[series.setData()](http://api.highcharts.com/highcharts/Series.setData)などの動的メソッドでシリーズデータを更新できます。あなたはそのID http://api.highcharts.com/highcharts/Chart.getで系列を取得し、series.data配列からその系列を抽出することができます - 例http://jsfiddle.net/8ce0euyg/を参照してください – morganfree

答えて

1

を変更する必要があり、私は似ていますが、一連のプロットのために何かを行っているが、これは確かにあなたが採用する必要があるアプローチを提供します。

if(series.name=='xyz'){//you can handle multiple legends by checking their name and have different calls for different legends 

        if (!this.visible) {// i want to make request for data only if when i click the legend and its visible 
        $.getJSON('xyzdata.php',{parameter1:xyz1,parameter2:xyz2}, function(data) {// making the call 
         series.setData(data.a);// with the returned data defining my plot 
         series.xAxis.setCategories(data.b); 
        }); 

}; 

関連する問題