如何从轴上捕捉点击事件jsplot,highcharts,flot

fon*_*fon 2 javascript jquery flot highcharts jqplot

我希望能够捕获链接到所有轴刻度的点击事件.这是我到目前为止所做的.

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

如果有人知道如何使用任何图表插件可以友好分享.

谢谢

sch*_*eld 5

情节不是简单的HTML.所以没有a标签.情节本身并没有为你提供一个api来捕捉click轴上的事件.

你可以做的是用jQuery手动选择轴刻度并添加一个click事件:

$('.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]);
        });
    }
});
Run Code Online (Sandbox Code Playgroud)

并且有解决方案:http://jsfiddle.net/scheffield/grVFk/5090/