Change Chart.js tooltip caret position for doughnut chart - Javascript Chart.js

Javascript examples for Chart.js:Chart Tooltip

Description

Change Chart.js tooltip caret position for doughnut chart

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Chart.js caret position</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js"></script> 
      <script type="text/javascript">
    window.onload=function(){//from ww  w .j a v a 2 s  .  c o  m
var ctx = document.getElementById("myChart");
var myChart = new Chart(ctx, {
  type: 'doughnut',
  data: {
    labels: ['Jan', 'Feb', 'Mar'],
    datasets: [{
      label: 'dataset',
      data: [30, 50, 20],
      backgroundColor: [
        'rgb(153, 102, 255)',
        'rgb(255, 205, 86)',
        'rgb(54, 162, 235)'
      ]
    }]
  },
  options: {
    tooltips: {
      yAlign: "bottom"
    }
  }
});
    }

      </script> 
   </head> 
   <body> 
      <canvas id="myChart" height="100"></canvas>  
   </body>
</html>

Related Tutorials