Answers for "set y axis scale chart.js"

0

chartjs start at 0

// v3.0+
new Chart(ctx, {
  type: 'line',
  data: data,
  options: {
    scales: {
      y: {
        min: 0
      }
    }
  }
}

// v2.0
new Chart(ctx, {
	type: 'line',
    data: data,
    options: {
    	scales: {
        	yAxes: [{
            	ticks: {
                	beginAtZero: true
            	}
        	}]
    	}
	}
})
Posted by: Guest on October-14-2020
1

chartjs min

var options = {
    scales: {
        yAxes: [{
            display: true,
            ticks: {
                suggestedMin: 0,    // minimum will be 0, unless there is a lower value.
                // OR //
                beginAtZero: true   // minimum value will be 0.
            }
        }]
    }
};
Posted by: Guest on November-04-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language