[Chartjs]-How to make y axis only integer scaling in ChartJS?

1👍

How can I make the Y axis only integer? where should I add it?

You can make the Y axis only integer by setting stepSize property to 1 for ticks in the chart options.

options: {
   scales: {
      yAxes: [{
         ticks: {
            stepSize: 1
         }
      }]
   }
}

see tick configuration options

How can I turn off the title which is “my open case”?

You can turn off the title (aka Legend) by setting display property to false for the legend.

options: {
   legend: {
      display: false
   }
}

see legend configuration

How can I turn off the background grids off?

You can turn off the background grids by setting gridLines‘s display property to false for both the x and y axis.

options: {
   scales: {
      xAxes: [{
         gridLines: {
            display: false
         }
      }],
      yAxes: [{
         gridLines: {
            display: false
         }
      }]
   }
}

see grid line configuration

ᴡᴏʀᴋɪɴɢ ᴇxᴀᴍᴘʟᴇ ᴏɴ ᴊꜱꜰɪᴅᴅʟᴇ

Leave a comment