Google Charts - "请求ID缺少查询:0"

Chr*_*ris 7 google-visualization

仅当我尝试将两个图表放在同一页面上时才会出现此错误.如果它们是页面上唯一的图表,则两个图表都能完美运行.我添加第二个只有第一个加载的那一分钟,我得到"请求ID为0的缺少查询"错误.
这是我的图表的js文件:

function drawChart(title, queryPage, divToFill) {
var dataTab = null;
var query = new google.visualization.Query(queryPage);
var strSQL = "SELECT *";

query.setQuery(strSQL);

query.send(processInitalCall);

function processInitalCall(res) {
    if(res.isError()) {
        alert(res.getDetailedMessage());
    } else {
        dataTab = res.getDataTable();

        // Draw chart with my DataTab
        drawChart(dataTab);
    }
}

function drawChart(dataTable) {
    // Draw the chart
    var options = {};
    options['title'] = title;
    options['backgroundColor'] = "#8D662F";
    var colors = Array();
    var x = 0;
    if(currentCampaignId >= 0) {
        while(x < dataTab.getNumberOfColumns() - 2) {
            colors[x] = '#c3c1b1';
            x++;
        }
        colors[x] = '#d2bc01';
    }
    else {
        colors[0] = '#c3c1b1';
    }
    options['colors'] = colors;
    options['hAxis'] = {title: "Week", titleColor: "white", textColor: "white"};
    options['vAxis'] = {title: "Flow", titleColor: "white", textColor: "white", baselineColor: "#937d5f", gridColor: "#937d5f"};
    options['titleColor'] = "white";
    options['legend'] = "none";
    options['lineWidth'] = 1;
    options['pointSize'] = 3;
    options['width'] = 600;
    options['height'] = 300;
    var line = new google.visualization.LineChart(document.getElementById(divToFill));
    line.draw(dataTab, options);
}
}  
Run Code Online (Sandbox Code Playgroud)

这是index.php文件中的一个剪辑:

<body>
<script type="text/javascript">
google.load('visualization', '1', {'packages': ['table', 'corechart']});
google.setOnLoadCallback(function(){
drawChart("Water", "waterData.php", "water");
drawChart("Air", "airData.php", "air");
});  

</script>
<div id="water" style="text-align: center;"></div>
<div id="air" style="text-align: center;"></div>
</body>  
Run Code Online (Sandbox Code Playgroud)

query.send(processInitalCall);只会在第二次调用时才会在行中抛出错误.除了sig字段外,waterData.php和airData.php都是相同的.我注意到有一个字段被调用reqId,它被设置为0.

我是否需要reqId在这些课程中以某种方式改变这一点?

And*_*jão 12

可能为时已晚,但对于任何有兴趣的人......

从数据源加载数据时,请求中将有一个GET参数 - tqx - 其值如下:"reqId:0".您必须在回复中返回相同的reqId.

来自文档:

要求 - [要求中要求; 数据源必须处理]此请求的数字标识符.这样使用,以便如果客户端在接收响应之前发送多个请求,则数据源可以使用正确的请求识别响应.在响应中返回此值.