2017-05-08 75 views
0

我使用高圖顯示散點圖。 數據提供給高圖表是在格式散點圖中的三點數據HighChart

[ 
    obj1 : [ 
       { 
       "x":"0.1", 
       "y":"12", 
       "id":"154" 
       },.... 
      ],.... 
] 

該曲線圖上繪製x上的y軸的正常。

我的問題是我想能夠使用第三個值時,我點擊任何點,但它是不可見的點。我試圖打印出它沒有任何形式的對象id的點對象。

任何幫助將appriciated。

+0

你能將此視頻添加到小提琴 –

回答

0
series: { 
       cursor: 'pointer', 
       point: { 
        events: { 
         click: function() { 
          // here I want the y value of the point in the 
          // first series even in this function 
          // is invoked for the point in the second series 
          alert('value: ' + this); 
         } 
        } 
       } 
      } 

請使用這個我認爲如果你打印這個對象它會給你所有的點,你在系列內傳遞。

+0

甚至OP尚未提供任何現場演示(小提琴,plunker等)。你可以添加示例來顯示你解釋的內容。 –

1

使用plotOptions點擊事件

plotOptions: { 
    series: { 
     dataLabels: { 
     align: 'left', 
     enabled: false, 
     format: '{point.id}', 

     }, 
     point: { 
     events: { 
      click: function() { 
      alert('Id: ' + this.id); 
      } 
     } 
     } 
    } 

    }, 

假設你的一系列數據猶如

data: [ 
    {x:161.2,y:51.6,id:154},{x:100.2,y:60.6,id:155},{x:161.2,y:151.6,id:157}] 

}] 

Fiddle demo