Javascript examples for Chart.js:Legend
Add mouseout event handler to legends in Chart.js
<html> <head> <title>Change cursor in chartjs</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <script type="text/javascript" src="https://npmcdn.com/chart.js@latest/dist/Chart.bundle.min.js"></script> <script type="text/javascript"> window.onload=function(){//from ww w .jav a2 s.com var ctx = document.getElementById("canvas1").getContext("2d"); var mychart = new Chart(ctx, { type: 'doughnut', data: { labels: ['uno', 'dos', 'tres', 'cuatro'], datasets: [{ data: [1, 2, 3, 4], backgroundColor: ["#BDC3C7","#9B59B6","#E74C3C","#26B99A"] }] }, options: { hover: { onHover: function(e) { $("#canvas1").css("cursor", "auto"); } }, legend: { position: 'bottom', onHover: function(c) { console.log(c); $("#canvas1").css("cursor", "pointer"); } }, } }); } </script> </head> <body> <canvas id="canvas1" height="150"></canvas> </body> </html>