Extend bar chart on Chart JS - Javascript Chart.js

Javascript examples for Chart.js:Bar Chart

Description

Extend bar chart on Chart JS

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.0.1/Chart.js"></script> 
      <script type="text/javascript">
    window.onload=function(){//from ww w  . j av a 2  s  .  c om
var config = {
  type: 'bar',
  data: {
    labels: ["January", "February", "March", "April", "May", "June", "July"],
    datasets: [{
      type: 'bar',
      label: "My First dataset",
      data: [65, 0, 80, 81, 56, 85, 40],
      fill: false
    },{
       type: 'line',
      label: "My Second dataset",
      data: [80, 80, 80, 80, 80, 80, 80, 80, 80],
      fill: false,
      borderColor: 'red',
      pointStyle: 'line',
      pointBorderWidth: 3
    }]
  }
};
var ctx = document.getElementById("myChart").getContext("2d");
new Chart(ctx, config);
    }

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

Related Tutorials