2016-02-27 28 views
0

我需要的信息形式,鼠标在Highcharts线图来看,我试图用工具提示,但因为有一个错误:函数语句需要一个名字。我已将格式化程序作为onclick函数放入plotOptions中。我不知道我是否可以一起使用这两个选项。我还需要获取线路名称。Highcharts鼠标点信息

plotOptions:{ 
 
       series:{ 
 
        allowPointSelect: true, 
 
        point: { 
 
         events:{ 
 
          click: function(e) {/*$("#displayText").html(e.currentTarget.y)*/ 
 
           
 
           tooltip: { 
 
\t       formatter: function() { 
 
          alert(this.x); 
 
            } 
 
            }, 
 
\t \t \t \t \t \t \t } 
 
         }       
 
        }, 
 
\t \t \t \t \t 
 
       } 
 
      },

+0

为什么里面有你'..point.events.click'一个'tooltip.formatter'? –

+0

@HalvorStrand当你点击一个点后,它会显示点击后点的x.axis等信息。点击这个点后我需要这些数据。其实我希望它能够在点击所选的点后返回这些信息。 – Adi

回答

1

好吧,我是完全错误的。这是检索折线图数据的答案。

plotOptions:{ 
 
       series:{ 
 
        allowPointSelect: true, 
 
        point: { 
 
         events:{ 
 
          click: function() { 
 
          alert('Category: ' + this.category + ', value: ' + this.series.name); //this.x+1 is the msgID 
 
          } 
 
         }       
 
        }, 
 
\t \t \t \t \t 
 
       } 
 
      },

相关问题