Configure y-axis on chart.js - Javascript Chart.js

Javascript examples for Chart.js:Axis

Description

Configure y-axis on chart.js

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>chart.js 2.1</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.1.0/Chart.bundle.min.js"></script> 
      <script type="text/javascript">
    window.onload=function(){/*from  ww  w . j  a va 2s.  c  om*/
var barChartData = {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [{
    label: 'Dataset 1',
    backgroundColor: "rgba(220,220,220,0.5)",
    data: [6, 6, 6, 8, 6, 9, 8]
}]
}
  var context = document.getElementById('stacked').getContext('2d');
  var myBar = new Chart(context, {
      type: 'bar',
      data: barChartData,
      options: {
          title:{
              display:true,
              text:"Chart.js Bar Chart - Stacked"
          },
          tooltips: {
              mode: 'label'
          },
          responsive: true,
      }
  });
    }

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

Related Tutorials