Chartjs multiple bar charts corresponding to one label - Javascript Chart.js

Javascript examples for Chart.js:Bar Chart

Description

Chartjs multiple bar charts corresponding to one label

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.1.6/Chart.bundle.min.js"></script> 
      <script type="text/javascript">
    window.onload=function(){//from w w  w.  j  a  v a 2 s  .c om
var chartData = {
   labels: ['2017-05-25', '2017-05-30', '2017-05-31'],
   datasets: [{
      label: "Reps",
      backgroundColor: "blue",
      data: [7, 8, 3]
   }, {
      label: "Reps",
      backgroundColor: "red",
      data: [0, 9, 7]
   }, {
      label: "Reps",
      backgroundColor: "green",
      data: [0, 10, 12]
   }]
};
var canvas = document.getElementById('canvas');
var myBarChart = new Chart(canvas, {
   type: "bar",
   data: chartData,
   options: {
      scales: {
         yAxes: [{
            display: true,
            ticks: {
               min: 0,
               max: 20
            }
         }]
      }
   }
});
    }

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

Related Tutorials