我有一点问题,我有这样的数组:
{"2017-10-20 17:09:40+CEST": 113, "2017-10-20 14:09:40+CEST": 98, "2017-10-22 13:09:40+CEST": 76, "2017-10-23 04:09:40+CEST": 0, "2017-10-22 15:09:40+CEST": 86, "2017-10-21 08:09:40+CEST": 3, "2017-10-22 23:09:40+CEST": 78, "2017-10-20 09:09:40+CEST": 4, "2017-10-20 23:09:40+CEST": 2, "2017-10-21 00:09:40+CEST": 23, "2017-10-22 11:09:40+CEST": 40, "2017-10-22 20:09:40+CEST": 96, "2017-10-20 13:09:40+CEST": 90, "2017-10-22 05:09:40+CEST": 28, "2017-10-20 16:09:40+CEST": 111, "2017-10-23 01:09:40+CEST": 51, "2017-10-21 23:09:40+CEST": 71, "2017-10-22 21:09:40+CEST": 90, "2017-10-23 06:09:40+CEST": 1, "2017-10-21 20:09:40+CEST": 95, "2017-10-21 10:09:40+CEST": 8, "2017-10-21 12:09:40+CEST": 51, "2017-10-21 15:09:40+CEST": 89, "2017-10-21 14:09:40+CEST": 83, "2017-10-21 09:09:40+CEST": 3, "2017-10-23 08:09:40+CEST": 1, "2017-10-21 22:09:40+CEST": 103, "2017-10-22 22:09:40+CEST": 80, "2017-10-21 11:09:40+CEST": 26, "2017-10-23 05:09:40+CEST": 0, "2017-10-21 01:09:40+CEST": 23, "2017-10-22 18:09:40+CEST": 100, "2017-10-22 01:09:40+CEST": 48, "2017-10-21 07:09:40+CEST": 4, "2017-10-20 20:09:40+CEST": 3, "2017-10-20 18:09:40+CEST": 108, "2017-10-22 17:09:40+CEST": 98, "2017-10-20 10:09:40+CEST": 20, "2017-10-23 11:09:40+CEST": 29, "2017-10-22 07:09:40+CEST": 24, "2017-10-23 07:09:40+CEST": 1, "2017-10-20 22:09:40+CEST": 2, "2017-10-20 21:09:40+CEST": 3, "2017-10-22 00:09:40+CEST": 63, "2017-10-22 06:09:40+CEST": 25, "2017-10-21 21:09:40+CEST": 95, "2017-10-20 12:09:40+CEST": 79, "2017-10-23 13:09:40+CEST": 67, "2017-10-23 09:09:40+CEST": 3, "2017-10-22 12:09:40+CEST": 60, "2017-10-20 19:09:40+CEST": 14, "2017-10-22 16:09:40+CEST": 94, "2017-10-21 16:09:40+CEST": 99, "2017-10-22 09:09:40+CEST": 21, "2017-10-22 19:09:40+CEST": 97, "2017-10-21 19:09:40+CEST": 99, "2017-10-21 03:09:40+CEST": 5, "2017-10-23 15:09:40+CEST": 90, "2017-10-22 02:09:40+CEST": 38, "2017-10-21 05:09:40+CEST": 5, "2017-10-21 06:09:40+CEST": 6, "2017-10-20 11:09:40+CEST": 48, "2017-10-22 10:09:40+CEST": 22, "2017-10-23 10:09:40+CEST": 10, "2017-10-22 03:09:40+CEST": 30, "2017-10-23 16:09:40+CEST": 104, "2017-10-23 00:09:40+CEST": 64, "2017-10-23 12:09:40+CEST": 53, "2017-10-21 13:09:40+CEST": 69, "2017-10-20 15:09:40+CEST": 103, "2017-10-21 02:09:40+CEST": 10, "2017-10-21 17:09:40+CEST": 102, "2017-10-22 04:09:40+CEST": 26, "2017-10-21 04:09:40+CEST": 5, "2017-10-21 18:09:40+CEST": 100, "2017-10-23 02:09:40+CEST": 20, "2017-10-22 14:09:40+CEST": 77, "2017-10-23 03:09:40+CEST": 3, "2017-10-23 14:09:40+CEST": 78, "2017-10-22 08:09:40+CEST": 24}}
我想使用它,因为我想创建带有高图的图形,但我有一点问题......我的价值是数组中的股票,这就是我尝试使用它的方式:
我必须按日期对值进行排序,因为每次值的顺序不同
series: [{
showInLegend: false,
data: Object.keys(array_24_h)
}]
但我的屏幕上什么也没有... 我从未做过(javascript)而且我不知道该怎么做。 所以欢迎任何帮助! 谢谢!
编辑:
这是我的完整代码:
$.ajax({
type: 'GET',
crossDomain: true,
url: 'http://pedago.fr/logtimes/',
success: function(data)
{
$('#zone').html("<div id='zone'>"+ data.current+"</div>");
array_24_h = data.past_day;// the output is above
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
backgroundColor: '#282b31',
type: 'line',
options3d: {
enabled: true,
alpha: 45
}
},
colors: ['#c7381f', '#0066FF', '#00CCFF'],
yAxis: {
allowDecimals: false,
title: {
text: 'users',
}
},
xAxis: {
showInLegend: false,
allowDecimals: false,
title: {
text: 'minute',
}
},
title: {
text: '12H',
style: {
color: '#878b8f',
font: 'bold 15px "Raleway", Verdana, sans-serif'
}
},
subtitle: {
text: ' '
},
plotOptions: {
pie: {
innerSize: 100,
depth: 45
}
},
credits: {
enabled: false
},
series: [{
showInLegend: false,
name: 'users',
data: //no idea
}]
});
});
},
error: function(){$('#zone').html("<div id='zone'> Cette requête AJAX n'a pas abouti </div>");}
});
答案 0 :(得分:0)