score:2

it looks like you are using chart.js v1 instead of v2.

first, update your the chart.js code to v2, preferably the latest version.

then, change the following code:

var bargraph = new chart(ctx, {
    type: 'bar',
    data: chartdata
    options: options
});

to:

var bargraph = chart.bar(ctx, {
  data: chartdata,
  options: options
});

beginatzero: true should then work as expected.

working jsfiddle: https://jsfiddle.net/ko54hp6n/


for an alternative to beginatzero: true, you can also use the min: 0 ticks configuration option to start the bar axis at zero:

var options = {
  scales: {
    yaxes: [{
      ticks: {
        min: 0
      }
    }]
  }
}

working jsfiddle: https://jsfiddle.net/ko54hp6n/1/


Related Query

More Query from same tag