ChartJS tooltip label for pie chart - Javascript Chart.js

Javascript examples for Chart.js:Chart Tooltip

Description

ChartJS tooltip label for pie chart

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.7.1/Chart.js"></script> 
      <script type="text/javascript">
    window.onload=function(){// w w  w.  ja v a 2  s  .  co  m
var ctx = document.getElementById('chart');
var chart = new Chart(ctx, {
    type: 'pie',
    data: {
        labels: ["I am a really really really really really really  really really really really really reallyreally really really really really really long label so long I might go off the chart"],
        datasets: [{
            data: [5],
        }]
    },
    options: {
        legend: {
            display: false
        },
        maintainAspectRatio: false,
        title: {
            display: false,
            fontSize: 16
        }
    }
});
    }

      </script> 
   </head> 
   <body> 
      <div style="width: 300px;"> 
         <canvas id="chart"></canvas> 
      </div>  
   </body>
</html>

Related Tutorials