0
我想从我的Json数据制作HighCharts图表。 这里是我的JSON数据HighCharts通过Json加载数据
[{"ReadData":"99","Time":"07\/09\/2015 00:00:07"},{"ReadData":"101","Time":"07\/09\/2015 00:01:07"},{"ReadData":"113","Time":"07\/09\/2015 00:02:07"},{"ReadData":"115","Time":"07\/09\/2015 00:03:07"},{"ReadData":"96","Time":"07\/09\/2015 00:04:07"},{"ReadData":"103","Time":"07\/09\/2015 00:05:07"}]
我的问题是,当该图形不加载,我在做什么错? 这是我的代码HTML。
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
<script>
$(document).ready(function() {
var options = {
chart: {
renderTo: 'container',
type: 'spline'
},
series: [{}]
};
$.getJSON('data.json', function(data) {
options.xAxis.categories = json[0]['Time'];
options.series[0] = json[0]['ReadData'];
var chart = new Highcharts.Chart(options);
});
});
</script>
</head>
</html>
JSON [ 0] ['Time']被替换为json [0] .Time;如果你能分享你的问题,那就更好了。初始化一个数组,并将时间和其他值放入其中,然后以高位图调用。 –