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
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
Share Improve this question edited Jun 20, 2020 at 9:12 CommunityBot 11 silver badge asked Oct 31, 2012 at 14:51 SteveEdsonSteveEdson 2,4952 gold badges29 silver badges46 bronze badges3 Answers
Reset to default 15The 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.
You could try another charting library. I often use flot for simple graphs, and raphael graphs for more complicated things (slightly harder to manipulate, and looks a bit more clunky to me)
gRaphael: http://g.raphaeljs.com/ Flot: http://www.flotcharts.org/