Skip decimal points on y-axis in chartJS

后端 未结 6 1270
说谎
说谎 2020-12-24 00:18

I am using this library to draw charts in my web app. The issue is that I am having decimal points in my y-axis. You can see that in the image below

Is there a way

6条回答
  •  再見小時候
    2020-12-24 00:45

    2019 Update

    This can now easily be achieved using the precision option:

    ticks: {
      precision:0
    }
    

    As per the documentation.

    If defined and stepSize is not specified, the step size will be rounded to this many decimal places.

    EXAMPLE

    options: {
      scale: {
        ticks: {
          precision: 0
        }
      }
    }
    

    OR (Single Axis)

    options: {
      scales: {
        xAxes: [{
          ticks: {
            precision: 0
          }
        }]
      }
    }
    

提交回复
热议问题