Answers for "chart js min y axis value"

4

chart.js y axis maximum value

var options = {
    scales: {
        yAxes: [{
            display: true,
            ticks: {
                beginAtZero: true,   // minimum value will be 0.
              	// <=> //
              	min: 0,
              	max: 10,
              	stepSize: 1 // 1 - 2 - 3 ...
            }
        }]
    }
};
Posted by: Guest on December-22-2020
0

chart js y axis integer

options: {  
    scales: {
        yAxes: [{
            ticks: {
                precision: 0
            }
        }]
    }
}
Posted by: Guest on October-13-2020
1

chart js two y axis

var canvas = document.getElementById('chart');
new Chart(canvas, {
  type: 'line',
  data: {
    labels: ['1', '2', '3', '4', '5'],
    datasets: [{
      label: 'A',
      yAxisID: 'A',
      data: [100, 96, 84, 76, 69]
    }, {
      label: 'B',
      yAxisID: 'B',
      data: [1, 1, 1, 1, 0]
    }]
  },
  options: {
    scales: {
      yAxes: [{
        id: 'A',
        type: 'linear',
        position: 'left',
      }, {
        id: 'B',
        type: 'linear',
        position: 'right',
        ticks: {
          max: 1,
          min: 0
        }
      }]
    }
  }
});
Posted by: Guest on November-03-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language