There is another fix you could do as well: change the first column's type
to "number" instead of "string", and set the first cell in each row equal
to the row index:
var data = new google.visualization.DataTable();
data.addColumn('number', 'Sample');
data.addColumn('number', 'Elevation');
for (var i = 0; i < results.length; i++) {
data.addRow([i, elevations[i].elevation]);
}
then you can turn off the axis labels and gridlines in the options:
chartz.draw(data, {
vAxis: {
minValue: 0,
title: 'Elevation (m)'
},
hAxis: {
textPosition: 'none',
gridlines: {
count: 0
}
},
width: 320,
height: 200,
legend: 'none',
focusBorderColor: '#00ff00'
});
This gives you the cleanest solution, and doesn't require you to change the
chart width or cut out any data.
On Thursday, September 12, 2013 10:45:10 PM UTC-4, asgallant wrote:
>
> Ahh, I see the problem now. It is because you have too many data points.
> Each column in the chart requires a minimum of 2 pixels, so with 256 rows
> of data (as in your example), the width of the chartArea (the portion where
> the columns are drawn, as opposed to the whole width of the chart, which
> includes the axis labels) must be at least 512 pixels in order to draw
> every column. You can either make the chart wider or reduce the number of
> rows of data (by skipping points in the elevation series). As an example,
> if you used a for loop like this:
>
> for (var i = 0; i < results.length; i += 2) {
> data.addRow(['', elevations[i].elevation]);
> }
>
> you would have half the number of elevation points.
>
> On Thursday, September 12, 2013 4:25:58 PM UTC-4, fablept . wrote:
>>
>> I´ve attached the files.
>>
>> -Line 15/16 in the HTML, commenting the corechart and uncommeting the
>> columnchart fix the issue.
>> -Line 93 *elevation.js* contains the draw chart options.
>> -Increasing the width in chart options to 660px will "fix" the issue.
>>
>> Thanks
>>
>>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.