The data should have whatever format you specify. If you want your labels
to be strings, use strings. If you want them to be numbers, use numbers.
Most of the visualizations use numbers for the data, but there are some
(tables come to mind) where that is not necessarily the case.
For your second question, yes you can do that. You would have to set up an
event handler for the table that retrieves data from the table and draws a
pie chart based on the data, which would look something like:
function drawTable() {
<set up table>
var table = new
google.visualization.Table(document.getElementById('table'));
table.draw(data, {<options>});
// add event listener
google.visualization.events.addListener(table, "select", function (e) {
var selection = visualization.getSelection();
// build array of selected rows (likely to be only 1 row, though IIRC)
var rows = [];
for (x in selection) {
rows[x] = selection[x]["row"];
}
// build data view
var view = new google.visualization.DataView(data);
// set rows for data view
view.setRows(rows);
// get new pie chart and draw it
var pie = new
google.visualization.PieChart(document.getElementById("pie_chart_div"));
pie.draw(view, {<options>});
});
}
You'll probably need to play around with the data in the data view to get it
to display how you want, but that's basically how it works.
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
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.