开发者

How to catch the click event from the axis ticks jqplot, highcharts,flot

I want to be able to catch the clicked event that is ho开发者_开发问答oked to all the axis ticks. here is what i have done so far.

http://jsfiddle.net/grVFk/5074/

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

thanks


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.net/scheffield/grVFk/5090/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜