最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin1浏览0评论

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/

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论