如何捕捉来自轴的点击事件勾选jqplot,highcharts,flot [英] How to catch the click event from the axis ticks jqplot, highcharts,flot

查看:190
本文介绍了如何捕捉来自轴的点击事件勾选jqplot,highcharts,flot的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够捕捉钩住所有轴标记的点击事件。
这是我迄今为止所做的。



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



如果有人知道如何做到这一点,任何图表插件都可以共享。



感谢

解决方案

情节并非纯粹的HTML。所以没有 a 标签。而情节本身并没有为你提供一个API来捕捉轴线上的点击事件。



什么你可以做的是用jQuery手动选择坐标轴并添加一个点击事件:

 < code $('。highcharts-axis tspan')。each(function(){
var label = $(this),
value = label.text();
if(categoryLinks [value]){
label.click(function(){
//你可以随心所欲......
alert('可以链接到另一个页面:' + categoryLinks [value]);
});
}
});

还有解决办法: http://jsfiddle.net/scheffield/grVFk/5090/

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.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/

这篇关于如何捕捉来自轴的点击事件勾选jqplot,highcharts,flot的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆