Change style of hover and tooltip in chartjs - Javascript Chart.js

Javascript examples for Chart.js:Chart Tooltip

Description

Change style of hover and tooltip in chartjs

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.min.js"></script> 
      <script type="text/javascript" src="https://istack.000webhostapp.com/chartjs-plugin-hoverline.js"></script> 
      <script type="text/javascript">
    window.onload=function(){/*from  w  ww .j av  a  2 s  .  c o  m*/
var chart = new Chart(ctx, {
   type: 'line',
   data: {
      labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May'],
      datasets: [{
         label: 'LINE',
         data: [3, 1, 4, 2, 5],
         backgroundColor: 'rgba(0, 119, 290, 0.15)',
         borderColor: 'rgba(0, 119, 290, 0.6)',
         lineTension: 0,
         pointRadius: 0,
         pointHoverRadius: 5,
         pointHoverBackgroundColor: 'white',
         pointHoverBorderWidth: 2
      }]
   },
   options: {
      lineOnHover: {
         enabled: true,
         lineColor: '#bbb',
         lineWidth: 1
      },
      scales: {
         yAxes: [{
            ticks: {
               beginAtZero: true,
               stepSize: 1
            }
         }]
      }
   }
});
    }

      </script> 
   </head> 
   <body> 
      <canvas id="ctx"></canvas>  
   </body>
</html>

Related Tutorials