gpt4 book ai didi

google-visualization - 谷歌图表 - "Missing Query for request id: 0"

转载 作者:行者123 更新时间:2023-12-04 10:45:03 24 4
gpt4 key购买 nike

仅当我尝试将两个图表放在同一页面上时才会出现此错误。如果这两个图表是页面上唯一的图表,则它们都可以完美运行。我只添加第二个加载第一个的那一刻,我收到“缺少请求 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);
}
}

这是 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>

它在 query.send(processInitalCall); 处抛出错误行,仅在第二次调用时。除了 sig 之外,waterData.php 和 airData.php 都是相同的。 field 。我确实注意到有一个字段叫 reqId并且设置为 0。

我需要以某种方式改变这个 reqId在这些类(class)中?

最佳答案

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

从数据源加载数据时,请求中会有一个GET参数—— tqx - 具有类似的值:“reqId:0”。您必须在响应中返回相同的 reqId。

来自 the docs :

reqId - [Required in request; Data source must handle] A numeric identifier for this request. This is used so that if a client sends multiple requests before receiving a response, the data source can identify the response with the proper request. Send this value back in the response.

关于google-visualization - 谷歌图表 - "Missing Query for request id: 0",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3718983/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com