I have the following code:
function drawVisualization() {
// Create and populate the data table.
var data = google.visualization.arrayToDataTable([
['Year', 'People'],
['2010',0]
]);
// Create and draw the visualization.
new google.visualization.ColumnChart(document.getElementById('visualization')).
draw(data,
{title:"Yearly Coffee Consumption by Country",
width:600, height:400,
hAxis: {title: "Year"},
backgroundColor: 'none'
}
);
}
Which gives me the following chart
How can I do to avoid showing negative values in the yAxis? I have tried adding
vAxis: {minValue:0}
without any luck.
There is a playground/sandbox for these charts: Google Charts Playground
The Google Chart API is an interactive Web service (now deprecated) that creates graphical charts from user-supplied data.
Negative numbers are to the left of the origin on the x-axis and below the origin on the y-axis. To graph with negative numbers, start at the origin and go to the left if the x-value is negative, and downward if the y-coordinate is negative. Points in quadrant I will always follow the format (+, +).
You need to set viewWindowMode as explicit
vAxis: {viewWindowMode: "explicit", viewWindow:{ min: 0 }}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With