I was looking into the ChartWrapper objects to see why we cannot get the
DataTable objects from remote queries, and it looks like they store the
local and remote DataTable objects in two places: local DataTable objects
are stored in ChartWrapper.h and remote query DataTable objects are stored
in ChartWrapper.Ph. If this is true, then it there should be a simple work
around for the problem: add a prototype function that returns
ChartWrapper.Ph, perhaps something like this:
google.visualization.ChartWrapper.prototype.getQueryDataTable = function() {
return this.Ph;};
But for some reason, this always returns null. Working from the Viz
playground's ChartWrapper with remote data test (
http://code.google.com/apis/ajax/playground/?type=visualization#chartwrapper_with_remote_data)
in Chrome, I changed the code to this:
function drawVisualization() {
// To see the data that this visualization uses, browse to
// http://spreadsheets.google.com/ccc?key=pCQbetd-CptGXxxQIG7VFIQ
google.visualization.ChartWrapper.prototype.getQueryDataTable = function(
) {return this.Ph;};
var wrapper = new google.visualization.ChartWrapper({
dataSourceUrl:
'http://spreadsheets.google.com/tq?key=pCQbetd-CptGXxxQIG7VFIQ&range=B1:D11&pub=1'
,
chartType: 'PieChart',
containerId: 'visualization'
});
wrapper.draw();
var data = wrapper.getQueryDataTable();
console.log(data);
console.log(wrapper);
console.log(wrapper.Ph);
}
The console.log dumps show data and wrapper.Ph are null, but if you examine
the dump for wrapper, you will see a DataTable object in wrapper.Ph. When I
try the same thing with a local DataTable object (dumping wrapper.h
instead), it works fine. Any ideas why ChartWrapper.Ph is returning null,
despite it not being null?
--
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/-/WciLfOTYVYwJ.
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.