图表Chart.js中的悬停事件

时间:2014-11-10 01:28:07

标签: chart.js

晚安 可以实现这样的东西吗?在chartjs http://grab.by/C1T6

canvas.mouseover = function(e){
    var activePoints = MyCharts.getBarsAtEvent(e);
    console.log(activePoints);
};

因此无法捕捉事件(

2 个答案:

答案 0 :(得分:0)

图表包含在div中,为什么不在这个元素上移动

$(function() {
    $("#element").mouseover(function(e) { /* implementation */ });
});

答案 1 :(得分:0)

So a little trick I found is you can use the customTooltip option to call your own function. It takes one object as a parameter, and is either false, or the segment that is being hovered over.