0

enter image description here

I am trying to add the Chartjs in my angular application. it's not loading the lowest value in the graph

my code

<canvas id="myChart" width="100" height="100" ng-if=""></canvas>

 var ctx = document.getElementById('myChart');
var myChart = new Chart(ctx, {
  type: 'bar',
  data: {
    datasets: [{
      label: 'Applied',
      data: [10, 20, 30],
      backgroundColor: 'rgb(66, 158, 244)'
    }, {
        label: 'Separated',
        data: [20, 40, 15],
        backgroundColor: 'rgb(193, 27, 71)'
    }],
    labels: ['January', 'February', 'March']
  },

  // Configuration options go here
  options: {}
});
Satti
  • 559
  • 2
  • 8
  • 26

1 Answers1

1

I think its because of the y-axis value got aligned with the data value (10 in this sample) and this made the bar invisible there. Can you try by specifying the y-axis ticks for the chart options as follows?

options: {
    scales: {
        yAxes: [{
            ticks: {
                min: 0,
                stepSize: 5,
            }
        }]
    }
}
Master Po
  • 1,497
  • 1
  • 23
  • 42