Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting a hard minimum axis value in Google Charts API

People also ask

How do you change the minimum and maximum values of an axis?

Right-click the axis then select Format Axis in the menu. The Format Axis panel appears on the right side of the window. Under Axis Options in the Format Axis panel, set the minimum and maximum axis values by entering a value in the Minimum and Maximum boxes under Bounds.

How do I change the axis scale in Google Sheets?

By default, Google Sheets will choose a scale for the x-axis and y-axis that ranges roughly from the minimum to maximum values in each column. To change the scale of the x-axis, simply double click any value on the x-axis.

How do I change the color of a bar graph in Google?

Select a data series. Click Color . Pick an option to set the color of the bars. Select Left axis or Right axis to move the axis labels.

How do you break axis in Google Sheets?

Simple answer: no, it is not possible. Breaking axes is (generally) frowned upon in the visualization community and therefore isn't supported most of the time in various software. If you want to be tricky, you can create a function to find outliers, and then move them to a second series in your data.


you need to set viewWindow like this:

var data = new google.visualization.DataTable();
data.addColumn('string', 'Date');
data.addColumn('number', 'Uptime');
data.addColumn('number', 'Downtime');
data.addRows([
 ['Dec 1, 1830',   99.875, 0.125],
  ['Dec 8, 1830',   99.675, 0.325],
  ['Dec 15, 1830',  99.975, 0.025],
  ['Dec 22, 1830',  100.0,  0.0]

]);

var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
chart.draw(data,
           {width: 400, 
            height: 240, 
            isStacked: true,
            vAxis: { 
              title: "Percentage Uptime", 
              viewWindowMode:'explicit',
              viewWindow:{
                max:100,
                min:99.8
              }
            }
            }                 
          );

//edited for newer version of api


I had a similar problem and had to specify the property as "min" not "minValue"

vAxis: { 
    viewWindowMode:'explicit',
    viewWindow: {
        max:100,
        min:99.8
    }
}