由于安全问题,我必须将所有数据从融合表移植到 excel 文件中,并且仍然保留用作谷歌地图来源的融合表功能。现在我面临的问题是我遇到了alasql。我想用它来执行我的任务。但我找不到任何记录在案的 alasql 示例,这些示例仅用于 javascript 的 excel 和 google 地图。
有人可以指出我可以参考的一个恰当的例子,或者任何关于 alasql 和 excel 和 gmaps 的文档。下面的代码是我必须从融合表移植到链接给出的 excel 文件的内容。
google.load('visualization', '1', {'packages':['table']});
function initialize() {
var map = new google.maps.Map(document.getElementById('map_canvas'), {
center: new google.maps.LatLng(55.7200,12.5700),
zoom: 2,
minZoom: 1,
maxZoom: 4,
mapTypeControl: false,
streetViewControl: false,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var layer = new google.maps.FusionTablesLayer({
query: {
select: 'Address',
from: '1234324235435435' // fusion table id here
},
suppressInfoWindows: true
});
layer.setMap(map);
google.maps.event.addListener(layer, 'click', function(e) {
var data = new google.visualization.DataTable();
data.addColumn('string', 'header1:');
data.addColumn('string', e.value1);
data.addRows([
['header2', e.value2],
['header3', e.value3],
['header4', e.value4],
['header5', e.value5],
['header6', e.value6],
['header7', e.value7],
['header8', e.value8],
['header9', e.value9],
['header10', e.value10],
]);
var chart = new google.visualization.Table(document.getElementById('chart'));
var options = {
'title': e.row['header'].value + ' ',
};
chart.draw(data, options);
});
}
function changeData(Sitecode) {
var whereClause = "";
if(Sitecode) {
whereClause = " WHERE 'Sitecode' = '" + Sitecode + "'"+"order by StartTime DESC limit 3";
}
var queryText = encodeURIComponent("SELECT 'Sitecode', 'IncidentID', 'IncidentReport', 'Resolved', 'StartTime' FROM 12345678" + whereClause);
var query = new google.visualization.Query('http://www.google.com/fusiontables/gvizdata?tq=' + queryText);
query.send(getData);
}
function getData(response) {
var table = new google.visualization.Table(document.getElementById('visualization'));
table.draw(response.getDataTable());
}
function UpgradeData(Sitecode) {
var whereClause = "";
if(Sitecode) {
whereClause = " WHERE 'Sitecode' = '" + Sitecode + "'";
}
var queryText = encodeURIComponent("SELECT 'Sitecode', 'curver' as Current_Version, 'upon' as Upgraded_On, 'upnext' as Next_Upgrade, 'upnotes' as Upgrade_Notes FROM 123456789" + whereClause);
var query = new google.visualization.Query('http://www.google.com/fusiontables/gvizdata?tq=' + queryText);
query.send(getdata);
}
function getdata(response) {
var table = new google.visualization.Table(document.getElementById('visualization1'));
table.draw(response.getDataTable());
}