Chart.js beginAtZero settings - Javascript Chart.js

Javascript examples for Chart.js:Chart Configuration

Description

Chart.js beginAtZero settings

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>chart.js 2.0 bar</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.6.0/Chart.min.js"></script> 
      <script type="text/javascript">
    window.onload=function(){//from w w  w.ja v  a2s. c om
var chartdata = {
  labels: ["January", "February", "March"],
  datasets: [{
    label: 'Count',
    backgroundColor: 'rgba(200, 200, 200, 0.75)',
    borderColor: 'rgba(200, 200, 200, 0.75)',
    hoverBackgroundColor: 'rgba(200, 200, 200, 1)',
    hoverBorderColor: 'rgba(200, 200, 200, 1)',
    data: [65, 59, 30],
  }]
};
var options = {
  scales: {
    yAxes: [{
      ticks: {
        min: 0
      }
    }]
  }
}
var ctx = document.getElementById('mycanvas');
var barGraph = Chart.Bar(ctx, {
  data: chartdata,
  options: options
});
    }

      </script> 
   </head> 
   <body> 
      <canvas id="mycanvas" width="100"></canvas>  
   </body>
</html>

Related Tutorials