Chart.JS - Polar area - Legend hover style and margin

前端 未结 3 2085
遇见更好的自我
遇见更好的自我 2021-01-15 15:38

Hi all,

Hopefully this is an easy one. I\'ve set up a legend with an onclick event but would like the mouse cursor to change to \"pointer\" when I hover ove

3条回答
  •  日久生厌
    2021-01-15 16:11

    The accepted answer did not work for me because my tooltips are always visible (position: "nearest"). So I use a timeout to change and revert the cursor style:

    onHover: function(event, legendItem) {
        document.getElementById("canvas").style.cursor = "pointer";
        clearTimeout(hoverTimeout); // global var
        hoverTimeout = setTimeout(function() {
            document.getElementById("canvas").style.cursor = "default";
        }, 100);
    }
    

    It's a dirty trick but it works.

提交回复
热议问题