score:16

Accepted answer

in your case, you can set stepsize property to 1 for y-axis ticks, to change the y-axis values from float number to integer.

options: {
   scales: {
      yaxes: [{
         ticks: {
            stepsize: 1
         }
      }]
   },
   ...
}

ᴅᴇᴍᴏ

var chart = new chart(ctx, {
   type: 'line',
   data: {
      labels: ['jan', 'feb', 'mar', 'apr'],
      datasets: [{
         label: '# of votes',
         data: [1, 2, 3, 4]
      }]
   },
   options: {
      scales: {
         yaxes: [{
            ticks: {
               stepsize: 1
            }
         }]
      }
   }
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/chart.js/2.6.0/chart.min.js"></script>
<canvas id="ctx"></canvas>

score:7

try this:

window.onload = function() {
            var chartel = document.getelementbyid("chart");
            window.myline = new chart(chartel, {
                type: 'line',
                data: linechartdata,
                options: {
                    title:{
                        display:true,
                        text:'kindmate - chart static donate'
                    },
                    tooltips: {
                        enabled: true,
                        mode: 'index',
                        position: 'nearest',
                        custom: customtooltips
                    },
                      scales: {
                         yaxes: [{
                             ticks: {
                                 beginatzero: true,
                                 callback: function(value) {if (value % 1   === 0) {return value;}}
                              }
                          }]
                     }
                }
            });

Related Query

More Query from same tag