Google Charts - Curved line chart not dropping incorrectly below 0

I have a Google bar chart, I set 'curveType': 'function' so that the graph is curved and has a nice look. My problem is that when the data point has a value of 0 followed by the next highest value, the chart drops below 0 so that the curve can fit correctly. It also makes vAxis have minRange -2000, this is not possible for my data (number of downloads over time).

I tried to solve this problem by setting 'minValue': 0 and 'viewWindowMode': 'maximized' to vAxis, but this did not solve the problem completely.

I have attached an image that explains my problem much better than I can in words.

If anyone knows a solution to this problem, without me, to return to straight lines, it would be very valuable. thanks

+8
source share
3 answers

Just a quick update on this. I realized that my data is not suitable for a curved graph, as it is discrete data, not continuous. I had to switch to straight lines, which fixed my problem. I do not know the perfect solution, but this is the one that worked for me.

+2
source

The curve can continue to fall below 0 no matter what you do, but you can crop the view so that the bottom of the displayed graph is 0. You can do this using 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.

+13
source

You can try another graphics library. I often use the fleet for simple graphs, and raphael graphs for more complex things (itโ€™s a bit more difficult to manipulate and it looks a bit more awkward for me)

gRaphael: http://g.raphaeljs.com/ Fleet: http://www.flotcharts.org/

0
source

All Articles