当我加载4个PHP文件时,我的chrome控制台出现了下一个问题,我加载了这些文件的查询以获得4个实时图表:
php文件有下一个代码:
<script>
var dataLength = 0;
var data = [];
var updateInterval = 40;
function updateTemp() {
$.getJSON("/data_temp.php", function (result) {
if (dataLength !== result.length) {
for (var i = dataLength; i < result.length; i++) {
data.push({
x: parseFloat(result[i].value1),
y: parseFloat(result[i].value2)
});
}
dataLength = result.length;
chart.render();
}
});
}
var chart = new CanvasJS.Chart("chart", {
animationEnabled: true,
zoomEnabled: true,
panEnabled: true,
title: {
text: "}Temp
},
axisX: {
tickThickness:0,
valueFormatString:" ",
},
axisY: {
maximum: 40.0,
minimum: 35.0,
},
data: [{
color:"black",
type:"spline", dataPoints: data}],
});
setInterval(updateTemp,updateInterval);
</script>
我用下一个代码绘制图表:
import itertools as it
def pick_pair(pairs):
pair = min(pairs, key=lambda p: p[0]['count'] + p[1]['count'])
pair[0]['count'] += 1
pair[1]['count'] += 1
return pair
team = [ {'name' : name, 'count' : 0} for name in range(6) ]
pairs = list(it.combinations(team,2))
day = 0
for i in range(len(pairs)):
print("Day {}: {}".format(day, pick_pair(pairs)))
day += 1
你知道我有什么错误吗?谢谢你的关注。 最好的祝福。