I can't say when the following issue began, but it was reported to me this
morning when PieCharts stopped displaying in InfoWindows in our mapping
application.
I do a Visualization Query against a Fusion Table:
google.visualization.Query('http://www.google.com/fusiontables/gvizdata?tq='
+ encodedQuery);
where the query is:
SELECT 'Occupant', *sum*('Louable m2'), rpu_id AS '30000452' FROM
1CwmvIaOdf7Rw5bleINc-1-jWSoQba1R7KbtX-wA WHERE 'rpu_id' = '30000452' GROUP
BY rpu_id,Occupant;
(Encoded, it looks like this:
SELECT%20'Occupant'%2C%20sum('Louable%20m2')%2C%20rpu_id%20AS%20'30000452'%20FROM%201CwmvIaOdf7Rw5bleINc-1-jWSoQba1R7KbtX-wA%20WHERE%20'rpu_id'%20%3D%20'30000452'%20GROUP%20BY%20rpu_id%2COccupant%20%3B
)
It seems the *SUMmed* column is returning NULL. I believe this is the
reason the charts are not rendering correctly.
I have confirmed that the 'Louable m2' column is of type Number.
Not sure what can be causing "sum" to suddenly not calculate numeric sums?
*Your assistance would be greatly appreciated!*
The following is the code, although this code has not changed in over a
year... so is probably not the issue:
function loadOccupantChart(UBI, FT_ID, blnAccessible) {
//**** Add pie-chart data to the infowindow dynamically calling sql
visualization query
//set the query (using UBI)
if (parms['lang'] == 'fra') {
var queryText = "SELECT 'Occupant', SUM('Louable m2'), rpu_id AS '"
+ UBI + "' FROM " + FT_ID + " WHERE 'rpu_id' = '" + UBI + "' GROUP BY
rpu_id,Occupant ;";
} else {
var queryText = "SELECT 'Tenant', sum('Louable m2'), rpu_id AS '" +
UBI + "' FROM " + FT_ID + " WHERE 'rpu_id' = '" + UBI + "' GROUP BY
rpu_id,Tenant ;";
}
var encodedQuery = encodeURIComponent(queryText);
var querySA = new
google.visualization.Query('http://www.google.com/fusiontables/gvizdata?tq='
+ encodedQuery);
//set the callback function
if (!blnAccessible) {
querySA.send(openOccupantsChart);
} else {
querySA.send(openOccupantsChartAccessible);
}
}
//////// START: Response functions that asynchronously creates the chart in
the "chart_container" div within the infowindow (marker layer)
function openOccupantsChart(responseChart) {
if (!responseChart) {
alert('no response');
return;
}
if (responseChart.isError()) {
alert('Error in query: ' + responseChart.getMessage() + ' ' +
responseChart.getDetailedMessage());
return;
}
// make table
var dtChart = responseChart.getDataTable();
var numRowsChart = dtChart.getNumberOfRows();
var numColsChart = dtChart.getNumberOfColumns();
var UBI_noBail = dtChart.getColumnLabel(2);
dtChart.removeColumn(2);
var formatter;
if (parms['lang'] == 'fra') {
formatter = new google.visualization.NumberFormat(
{ suffix: ' mètres carrés', decimalSymbol: ',', groupingSymbol:
' ' });
} else {
formatter = new google.visualization.NumberFormat(
{ suffix: ' square metres' });
}
formatter.format(dtChart, 1); // Apply formatter to second column
// Create chart from datatable
var chart;
var options = {
legend: { position: "right", textStyle: { color: 'blue'} },
width: 350,
height: 235,
chartArea: { left:10, top:10, width:"97%", height: "97%"}
};
try {
chart = new
google.visualization.PieChart(document.getElementById('chart_containerOccupant'
+ UBI_noBail));
chart.draw(dtChart, options);
} catch (e) {
setTimeout(function() {
chart = new
google.visualization.PieChart(document.getElementById('chart_containerOccupant'
+ UBI_noBail));
chart.draw(dtChart, options);
}, 1000);
}
}
--
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/d/optout.