我们正在使用 jquery ajax 调用来渲染 highcharts,因为我使用 setInterval 每 1 分钟渲染一次动态图,我的 cpu 内存消耗更多,几乎达到 100%,我在 chrome 中获得了杀死页面,你能帮我解决它吗
函数 DataSiftGraph(){
$.ajax({
url: "ViewGraphServlet",
type: 'POST',
data:{"flag":true,"hrefValue":searchKeyGraph},
contentType:"application/x-www-form-urlencoded",
success: function (response) {
tweets=response.tweets;
for(var i=0;i<tweets.length;i++){
descArray[i]=tweets[i];
//alert(descArray[i]);
document.getElementById("detailedcs").innerHTML+= descArray[i]+'<br/>';
}
stopFlag=response.stopFlag;
//series.data.push(formattedTime,response.positiveCount);
//chart.series[0].data.push(formattedTime,response.positiveCount);
shift = chartSentiment.series[0].data.length > 20;
chartSentiment.series[0].addPoint([response.toDate,response.positiveCount],true,shift);
chartSentiment.series[1].addPoint([response.toDate,response.negativeCount],true,shift);
chartSentiment.series[2].addPoint([response.toDate,response.neutralCount],true,shift);
//alert("response.affectionCount" + response.affectionCount);
chartEmotion.series[0].addPoint([response.toDate,response.affectionCount],true,shift);
chartEmotion.series[1].addPoint([response.toDate,response.amusementCount],true,shift);
chartEmotion.series[2].addPoint([response.toDate,response.contentCount],true,shift);
chartEmotion.series[3].addPoint([response.toDate,response.enjoymentCount],true,shift);
chartEmotion.series[4].addPoint([response.toDate,response.angerCount],true,shift);
chartEmotion.series[5].addPoint([response.toDate,response.fearCount],true,shift);
chartEmotion.series[6].addPoint([response.toDate,response.humiliationCount],true,shift);
chartEmotion.series[7].addPoint([response.toDate,response.sadnessCount],true,shift);
},
error: function(response, ajaxOptions, thrownError) {
}
});
}
这是我使用的示例代码