Draw chart.js created - Javascript Chart.js

Javascript examples for Chart.js:Chart Configuration

Description

Draw chart.js created

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.4.0/Chart.js"></script> 
      <script type="text/javascript">
    window.onload=function(){/*from w  ww  .  j av  a 2 s.c o m*/
var ctx = document.getElementById("chartjs");
var myChart = new Chart(ctx, {
    type: 'doughnut',
    data: {
        labels: ["A", "B"],
        datasets: [{
            data: [70, 50],
            backgroundColor: ['red', 'pink']
        }]
    },
});
    }

      </script> 
   </head> 
   <body> 
      <canvas id="chartjs" width="300" height="300"></canvas>  
   </body>
</html>

Related Tutorials