I have a Google line chart, I set 'curveType': 'function'
so the graph is curved and has a nice appearance. My problem is that when a data point has a value of 0, followed by a following high value, the chart dips below 0 so that the curve can fit correctly. This also causes the vAxis to have a minRange of -2000, this isn't possible for my data (number of downloads over time).
I've tried to solve this by setting 'minValue': 0
and 'viewWindowMode': 'maximized'
on the vAxis, but it hasn't solved the problem completely.
I have attached an image that will explain my problem a lot better than I can with words.
If anyone knows a solution to this, without me having to go back to straight lines, it would be much appreciated. Thanks
The curve may continue to dip below 0 no matter what you do, but you can crop the view so the lowest point of the displayed graph is at 0. You can do that with the vAxis.viewWindow.min property:
lineChart.draw(data,
{
curveType: "function",
vAxis: {viewWindow: {min:0} }
}
);
See the LineChart documentation for information on vAxis.viewWindow.min and other configuration options.
Just a quick update on this. I realised that my data work not be suitable for a curved graph anyway, as it is discrete data and not continuous. I had to switch back to straight lines, which removed my problem. Not an ideal solution, I know, but it is one that worked for me.
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