3

I use angular-chart.js and chart.js 2.0.2 - I have bar char. It is my code for chart in index.slim

canvas#bar.chart.chart-bar chart-data="data" chart-labels="labels" chart-options="options"

How Can I set beginAtZero options (other options works (f.e display: true )) in my controller I tried:

$scope.options = {
    scale: {
      ticks: {
        beginAtZero: true
      }
    }
  };

What I did wrong?

myf
  • 185
  • 1
  • 3
  • 11

2 Answers2

2

Try this:

$scope.options = {
  scales: {
    yAxes: [{
      ticks: {
        beginAtZero: true
      }
    }]
  }
};
Hongliang
  • 76
  • 4
2

If you aren't using a horizontal Bar, the answer of Hongliang should work.

Otherwise just change "yAxes" to "xAxes", like this:

$scope.options = {
        scales: {
            xAxes: [{
                ticks: {
                    beginAtZero: true
                }
            }]
        }
    }
eDonkey
  • 606
  • 2
  • 7
  • 25