0

我有一个数据表(在 Google 图表中),我想发送 URL 以连接我的数据表并发送查询,并在我的页面 web 中显示数据后,使用 JavaScript。我该怎么做?

这是我的代码。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>
      Google Visualization API Sample
    </title>
    <script type="text/javascript" src="http://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load('visualization', '1.0', {packages: ['corechart']});
    </script>
    <script type="text/javascript">

      function sendQuery(YYY)  {
           var query = new google.visualization.Query('http://localhost:8080/XXX-datasource/datasource?table=YYY');
           //query.setQuery('select zone_name, sum(cost) group by zone_name');
           console.log(query);

      }


    </script>
  </head>
</html>
4

1 回答 1

0

假设您服务器上的数据源与可视化 API 查询兼容,您将使用类似https://code.google.com/apis/ajax/playground/?type=visualization#using_the_query_language的内容,替换您自己的 url,选择语句和图表代码。

于 2013-07-31T15:22:21.747 回答