mattetti/googlecharts

Line chart stretching data sets

Opened this issue · 1 comments

More of a question than anything...
How do you stop two lines from stretching to be the same length if one contains less data than the other.
For instance my data is:

[[17, 28, 49, 59, 62], [24, 40, 52, 63]]

which produces this:

http://chart.apis.google.com/chart?chxt=x,y&chco=375987,e35a27,e58e6f,6b8baa&chf=bg,s,ffffff|c,s,FFFFFF&chd=s:Qbw69,Xnz9&cht=lc&chs=760x380&chxr=0,0,5,0|1,0,63,12

What I need is the orange line to end at 4 on the x axis.
Any help on this is much appreciated, thanks in advance.

Issue resolved: needed to do a bit of data manipulation before generating the graph. As a reference for anyone with this problem in the future, add nulls to the data sets you want shortened until it equals the largest data set in your array. For example:

[[17, 28, 49, 59, 62], [24, 40, 52, 63, nil]]
OR
[[17, 28, 49, 59, 62], [24, 40, 52, 63, nil], [15, 64, nil, nil, nil]]