Chart.js Subtitle for pie chart - Javascript Chart.js

Javascript examples for Chart.js:Pie Chart

Description

Chart.js Subtitle for pie chart

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>ChartJS Line Chart</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.7.0/Chart.js"></script> 
      <script type="text/javascript">
    window.onload=function(){// w  w  w . ja v  a 2 s  .  c  om
var options = {
  type: 'pie',
  data: {
    labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
    datasets: [
       {
         data: [12, 19, 3, 5, 2, 3]
       }
      ]
  },
  options: {
     title: {
        display: true,
        position: 'top',
        text: ['Screened','Subtitle'],
        fontSize: 14
    },
  }
}
var ctx = document.getElementById('chartJSContainer').getContext('2d');
new Chart(ctx, options);
    }

      </script> 
   </head> 
   <body> 
      <canvas id="chartJSContainer" width="600" height="400"></canvas>  
   </body>
</html>

Related Tutorials