我已经创建了一个highchart
我从 csv 文件中获取的数据。图表运行良好并且绘图很好。但我的问题是当页面刷新时它没有从 csv 文件中获取最新值。它仍然显示旧图表。当我关闭浏览器并重新打开图表工作正常。请帮助我如何使用来自 csv 的更新值重置/重绘下面是我的代码。这个问题发生在 IE 中而不是 Firefox 中。如果我右键单击显示的图表并导出到 excel,那么它会显示更新的值,但不会绘制具有更新值的图表。
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="Cache-Control" content="no-store" />
<LINK REL="StyleSheet" HREF="../style/default.css" TYPE="text/css"
MEDIA="screen">
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/highcharts.js"></script>
<script type="text/javascript">
var chart;
$(document).ready(function() {
cache:false
var options="";
options = {
chart: {
renderTo: 'container',
defaultSeriesType: 'column'
},
title: {
text: 'Incident Status'
},
xAxis: {
categories: []
},
yAxis:
{
allowDecimals:false, tickInterval:15,
title: {
text: 'Issue Count'
}
},
series: []
};
/*
Load the data from the CSV file. This is the contents of the file:
Apples,Pears,Oranges,Bananas,Plums
John,8,4,6,5
Jane,3,4,2,3
Joe,86,76,79,77
Janet,3,16,13,15
*/ $.get('../data/incident_status.txt', function(data) {
// Split the lines
var lines = data.split(';');
$.each(lines, function(lineNo, line) {
var items = line.split(',');
// header line containes categories
if (lineNo == 0) {
$.each(items, function(itemNo, item) {
if (itemNo > 0) options.xAxis.categories.push(item);
});
}
// the rest of the lines contain data with their name in the first position
else {
var series;
series= {
data: [],
pointWidth: 28
};
$.each(items, function(itemNo, item) {
if (itemNo == 0) {
series.name = item;
} else {
series.data.push(parseFloat(item));
}
});
options.series.push(series);
}
});
chart = new Highcharts.Chart(options);
chart.destroy();
chart = new Highcharts.Chart(options);
});
}); </script>
<body>
<div id="wrapper">
<div class="container">
<div id="banner" >
<div class="img-border"> <img src="../images/logo.jpg" width="1120" height="111px" alt="" /> </div>
</div>
<div id="container" style="width: 100%; height: 400px; margin: 0 auto"></div>
<?php include('../control/incidentstatus_gen.php');?>
</div>
</div>
<body> </html>