2013-02-21 82 views

回答

2

可以用户系列click事件:

DEMO

series: { 
    cursor: 'pointer', 
    point: { 
     events: { 
      click: function() { 
       alert ('Category: '+ this.category +', value: '+ this.y); 
      } 
     } 
    } 
} 
+0

这是highcharts演示,但我的意思highstock。我从highcharts中找到这个例子:[link] http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/stock/xaxis/events-setextremes/ – 2013-02-21 17:48:47

3

如果使用Highstock那么你可以得到的x值(时间以毫秒为单位),并使用Highcharts.dateFormat(),它在适当的返回数据格式。 (http://api.highcharts.com/highstock#highcharts.dateFormat()

http://jsfiddle.net/NX4KN/

plotOptions: { 
      series: { 
       cursor: 'pointer', 
       point: { 
        events: { 
         click: function() { 
          alert('Date: ' + Highcharts.dateFormat('%Y-%m-%d',this.x) + ', value: ' + this.y); 
         } 
        } 
       } 
      } 
     } 
相关问题