Set Min & Max Yaxis in the column chart

Viewed 37

I have this issue below:

I need to set a min & Max value to the chart.

I have tried Scale but it doesn't work.

function drawChart1() {
   // Define the chart to be drawn.
   var data = google.visualization.arrayToDataTable([
       ['Year', 'Actual', { role: 'annotation' }, 'Target', { role: 'annotation' }],
       ['2017', 1, '1', 0, '0'],
       ['2018', 1, '1', 0, '0'],
       ['2019', 0, '0', 0, '0'],
       ['2020', 0, '0', 0, '0'],
       ['2021', 0, '0', 0, '0'],
       //['2018', 0.0, '0.0', 0.025, '0.025']
   ]);

   //  title: '%' // in opption
   var options = {
       title: '', colors: ['#00A3E0', '#84BD00'],
   };

   // Instantiate and draw the chart.
   var chart = new google.visualization.ColumnChart(document.getElementById('container1'));
   chart.draw(data, options);
}
google.charts.setOnLoadCallback(drawChart1);
1 Answers

use the following vAxis options...

var options = {
   title: '',
   colors: ['#00A3E0', '#84BD00'],

   // use following options...
   vAxis: {
     viewWindow: {
       min: 0,
       max: 1
     }
   }
};
Related