我正在使用高图表股票,它使用json绘制图表。 我已经将我自己的本地文件放在本地服务器上更改了高库存json文件,但是它不起作用并且给出了高char json文件的结果,即使我已经更改了json文件数据。 问题是图表没有根据我的本地文件进行绘图,它产生了我用本地文件替换的highchart json文件的结果。 请找到以下代码。
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Highstock Example</title>
<style type="text/css">
</style>
</head>
<body>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="highstock.js"></script>
<script src="exporting.js"></script>
<script src="export-data.js"></script>
<div id="container" style="height: 400px; min-width: 310px"></div>
<script type="text/javascript">
<!-- below get json file is the local file that contain chart data -->
$.getJSON('http://localhost:2904/WebSite1/aapl-c.json', function (data) {
// Create the chart
Highcharts.stockChart('container', {
rangeSelector: {
selected: 1
},
title: {
text: 'AAPL Stock Price'
},
series: [{
name: 'AAPL Stock Price',
data: data,
type: 'area',
threshold: null,
tooltip: {
valueDecimals: 2
},
fillColor: {
linearGradient: {
x1: 0,
y1: 0,
x2: 0,
y2: 1
},
stops: [
[0, Highcharts.getOptions().colors[0]],
[1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')]
]
}
}]
});
});
</script>
</body>
</html>
JSON FIle :
[
[1147651200000,1100.79],
[1147737600000,64.98],
[1147824000000,65.26],
[1147651200000,1167.79],
[1147737600000,64.98],
[1147824000000,65.26],
[1147651200000,1167.79],
[1147737600000,64.98],
[1147824000000,65.26],
[1147651200000,1167.79],
[1147737600000,64.98],
[1147824000000,65.26],
[1147651200000,1167.79],
[1147737600000,64.98],
[1147824000000,65.26],
[1147651200000,1167.79],
[1147737600000,64.98],
[1147824000000,65.26],
]