Google visualization 谷歌图表与融合表示例错误

Google visualization 谷歌图表与融合表示例错误,google-visualization,google-fusion-tables,Google Visualization,Google Fusion Tables,好的,我从google的图表工具文档中复制并粘贴了这个示例: 我只是简单地用我的信息替换了他们的融合表信息,但无法显示该表 这就是我现在将fusion table设置为public access时得到的结果: <html> <head> <meta charset="UTF-8"> <title>Fusion Tables API Example: Google Chart Tools Data Table</title> &

好的,我从google的图表工具文档中复制并粘贴了这个示例:

我只是简单地用我的信息替换了他们的融合表信息,但无法显示该表

这就是我现在将fusion table设置为public access时得到的结果:

    <html>
<head>
<meta charset="UTF-8">
<title>Fusion Tables API Example: Google Chart Tools Data Table</title>
<link href="/apis/fusiontables/docs/samples/style/default.css"
    rel="stylesheet" type="text/css">
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
  google.load('visualization', '1', { packages: ['table'] });

  function drawTable() {
    var query = "SELECT 'fundraiser' as fundraiser, " +
        "'price' as price, 'merchant' as merchant " +
        'FROM 1QN6e86FybBULPekKvvXd_RF1jw01H7bZAJFjhUg';
    var fundraiser = document.getElementById('fundraiser').value;
    if (team) {
      query += " WHERE 'fundraiser' = '" + fundraiser + "'";
    }
    var queryText = encodeURIComponent(query);
    var gvizQuery = new google.visualization.Query(
        'http://www.google.com/fusiontables/gvizdata?tq=' + queryText);

    gvizQuery.send(function(response) {
      var table = new google.visualization.Table(
          document.getElementById('visualization'));
      table.draw(response.getDataTable(), {
        showRowNumber: true
      });
    });
  }

  google.setOnLoadCallback(drawTable);
</script>
</head>
<body>
<div>
  <label>Scoring Team:</label>
  <select id="fundraiser" onchange="drawTable();">
    <option value="">All</option>
    <option value="default">default</option>
    <option value="aaaatester">aaaatester</option>
  </select>
</div>
<div id="visualization"></div>
</body>
</html>

Fusion Tables API示例:Google图表工具数据表
load('visualization','1',{packages:['table']});
函数drawTable(){
var query=“选择“筹款人”作为筹款人,”+
“‘价格’作为价格,‘商家’作为商家”+
“自1QN6E86FYBBULPEKKVXD_RF1jw01H7bZAJFjhUg起”;
var fundraiser=document.getElementById('fundraiser').value;
国际单项体育联合会(小组){
查询+=“其中‘筹款人’=”+筹款人+”;
}
var queryText=encodeURIComponent(查询);
var gvizQuery=new google.visualization.Query(
'http://www.google.com/fusiontables/gvizdata?tq=“+queryText);
gvizQuery.send(函数(响应){
var table=新的google.visualization.table(
document.getElementById('visualization');
table.draw(response.getDataTable(){
showRowNumber:真
});
});
}
setOnLoadCallback(drawTable);
计分小组:
全部的
违约
AAA测试仪

我不确定您的查询到底出了什么问题,但这对我很有用:

function drawTable () {
    console.log('foo');
    var query = 'SELECT fundraiser, price, merchant FROM 1QN6e86FybBULPekKvvXd_RF1jw01H7bZAJFjhUg';
    var fundraiser = document.getElementById('fundraiser').value;
    if (fundraiser) {
        query += ' WHERE fundraiser = \'' + fundraiser + '\'';
    }
    var queryText = encodeURIComponent(query);
    var gvizQuery = new google.visualization.Query('http://www.google.com/fusiontables/gvizdata?tq=' + queryText);

    gvizQuery.send(function(response) {
        if (response.isError()) {
            alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
            return;
        }
        var table = new google.visualization.Table(document.getElementById('visualization'));
        table.draw(response.getDataTable(), {
            showRowNumber: true
        });
    });
}

function init () {
    // draw the table
    drawTable();

    // setup the fundraiser dropdown to redraw the table when the user changes the value
    var el = document.querySelector('#fundraiser');
    if (document.addEventListener) {
        el.addEventListener('change', drawTable);
    }
    else if (document.attachEvent) {
        el.attachEvent('onchange', drawTable);
    }
    else {
        el.onchange = drawTable;
    }
}
google.load('visualization', '1', {packages: ['table'], callback: init});
将其作为HTML:

<div>
    <label>Scoring Team:</label>
    <select id="fundraiser">
        <option value="">All</option>
        <option value="default">default</option>
        <option value="aaaatester">aaaatester</option>
    </select>
</div>
<div id="visualization"></div>

计分小组:
全部的
违约
AAA测试仪
但是,我建议,如果要使用这样的过滤器(初始查询未经过滤),则应切换到使用过滤器在浏览器中过滤数据,而不是每次用户更改过滤器时都向服务器查询。对服务器进行重复查询唯一有意义的时间是,使用多个过滤查询时,进出服务器的总流量可能大大低于使用单个未过滤查询时的流量。

可能重复的