Hide specific ticks in y-axis and hide all x-axis grid line - Javascript Chart.js

Javascript examples for Chart.js:Line Chart

Description

Hide specific ticks in y-axis and hide all x-axis grid line

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.3/Chart.min.js"></script> 
      <script type="text/javascript">
    window.onload=function(){//from   w ww.j  a  v  a  2  s .c  om
var humdays = document.getElementById("charthumdays");
var humdaysChart = new Chart(humdays, {
  type: 'bar',
  data: {
    labels: ["15 mar", "16 mar", "17 mar", "18 mar", "19 mar", "20 mar", "21 mar"],
    datasets: [{
      label: "humidity",
      data: [60, 20, 30, 50, 60, 80, 90],
      backgroundColor: "#D9B090",
      hoverBackgroundColor: 'rgba(217,176,144,0.8)'
    }]
  },
  options: {
    scales: {
      xAxes: [{
        gridLines: {
          display: false
        }
      }],
      yAxes: [{
        ticks: {
          min: 0,
          max: 100,
          stepSize: 50
        }
      }]
    }
  }
});
humdaysChart.options.legend.display = false;
    }

      </script> 
   </head> 
   <body> 
      <canvas id="charthumdays" width="500" height="350"></canvas>  
   </body>
</html>

Related Tutorials