I have a Google visualization query for which data is coming from fusion table as,
var query = new google.visualization.Query("https://www.google.com/fusiontables/gvizdata?tq=select * from *******************");
But it select only first 500 rows of data. How to overcome this limitation?
The Fusion Tables SQL queries are deprecated. The new version of the API is not limited to 500 rows, see the Fusion Tables API for details.
Edit:
Here is an example Dashboard using the Google Fusion Tables code Odi posted in comments below:
function drawTable(response) {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Country Name');
data.addColumn('number', 'Population in 1960');
data.addColumn('number', 'Population in 2000');
var rows = [];
for (var i = 0; i < response.rows.length; i++) {
rows.push([response.rows[i][0], parseInt(response.rows[i][1]), parseInt(response.rows[i][2])]);
}
data.addRows(rows);
var table = new google.visualization.ChartWrapper({
containerId: 'table_div',
chartType: 'Table',
options: {
}
});
var control = new google.visualization.ControlWrapper({
containerId: 'control_div',
controlType: 'StringFilter',
options: {
filterColumnIndex: 0
}
});
var dashboard = new google.visualization.Dashboard(document.querySelector('#dashboard'));
dashboard.bind([control], [table]);
dashboard.draw(data);
}
function getData() {
// Builds a Fusion Tables SQL query and hands the result to dataHandler
var queryUrlHead = 'https://www.googleapis.com/fusiontables/v1/query?sql=';
var queryUrlTail = '&key=AIzaSyCAI2GoGWfLBvgygLKQp5suUk3RCG7r_ME';
var tableId = '17jbXdqXSInoNOOm4ZwMKEII0sT_9ukkqt_zuPwU';
// write your SQL as normal, then encode it
var query = "SELECT 'Country Name', '1960' as 'Population in 1960', '2000' as 'Population in 2000' FROM " + tableId + " ORDER BY 'Country Name' LIMIT 10";
var queryurl = encodeURI(queryUrlHead + query + queryUrlTail);
var jqxhr = $.get(queryurl, drawTable, "jsonp");
}
google.load('visualization', '1', {packages:['controls'], callback: getData});
See it working here: http://jsfiddle.net/asgallant/6BXsy/
Give the date format yyy-mm-dd
, this is how you would create Date objects from it:
var data = new google.visualization.DataTable();
data.addColumn('date', 'Date');
// other columns
var rows = [], dateArray, year, month, day;
for (var i = 0; i < response.rows.length; i++) {
dateArray = response.rows[i][0].split('-');
year = parseInt(dateArray[0]);
month = parseInt(dateArray[1]) - 1;
day = parseInt(dateArray[2]);
rows.push([new Date(year, month, day) /*, other data */]);
}
data.addRows(rows);