javascript - How to catch the click event from the axis ticks jqplot, highcharts,flot - Stack Overflow

I want to be able to catch the clicked event that is hooked to all the axis ticks.here is what i have

I want to be able to catch the clicked event that is hooked to all the axis ticks. here is what i have done so far.

/

If anyone knows how to do that with any of the charting plugins can kindly share.

thanks

I want to be able to catch the clicked event that is hooked to all the axis ticks. here is what i have done so far.

http://jsfiddle/grVFk/5074/

If anyone knows how to do that with any of the charting plugins can kindly share.

thanks

Share Improve this question edited Oct 12, 2011 at 10:58 Book Of Zeus 49.9k18 gold badges175 silver badges171 bronze badges asked Apr 18, 2011 at 7:03 fonfon 2652 gold badges7 silver badges16 bronze badges 2
  • how did you put up that chart in jsfiddle?? – S L Commented Apr 18, 2011 at 7:07
  • well i have anccount there so i can upload it things there. well u can also continue to work on mine or u create an account there and upload ur own files – fon Commented Apr 18, 2011 at 7:30
Add a ment  | 

1 Answer 1

Reset to default 5

the plot isn't plain HTML. So there is no a tag. And the plot itself do not provide you with an api to catch the click event on an axis tick.

What you can do is to select the axis tick manually with jQuery and add a click event:

$('.highcharts-axis tspan').each(function(){
    var label = $(this),
        value = label.text();
    if(categoryLinks[value]) {
        label.click(function(){
            // you' free to what you want...
            alert('could link to another page: ' + categoryLinks[value]);
        });
    }
});

And there is the solution: http://jsfiddle/scheffield/grVFk/5090/

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745356782a4624165.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信