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

雨燕双飞 提交于 2019-12-12 07:38:47

问题


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


回答1:


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/



来源:https://stackoverflow.com/questions/5699541/how-to-catch-the-click-event-from-the-axis-ticks-jqplot-highcharts-flot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!