Here's a simple example I drew up. I don't have any google spreadsheets to
work from, so you'll have to tweak it to your own needs, but the
functionality is there:
function drawChart() {
var query = new
google.visualization.Query('http://spreadsheets.google.com/tq?key=<your
spreadsheets key>&pub=1');
// Assumes that column:
// A is the date
// B is the first series values
// C is the first series annotations
// D is the first series annotation text
// E is the second series values
// F is the second series annotations
// G is the second series annotation text
query.setQuery('SELECT A,B,C,D,E,F');
// Send the query with a callback function.
query.send(handleQueryResponse);
}
function handleQueryResponse(response) {
if (response.isError()) {
alert('Error in query: ' + response.getMessage() + ' ' + response.
getDetailedMessage());
return;
}
var data = response.getDataTable();
var chart = new google.visualization.AnnotatedTimeline(document.
getElementById('chart_div'));
chart.draw(data, {
displayAnnotations: true,
scaleColumns: [0, 1],
scaleType: 'allfixed'
});
}
The charts width and height must be explicitly defined for the chart div or
the draw will fail:
<div id="chart_div" style="width: 500px; height: 300px;"></div>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-visualization-api/-/OHX9N9jWSj8J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.