/api/data?q=user #获取的是关于user的json数据
/api/data?q=system #获取的是关于system的json数据
#数据都是增量数据
$(function () {
Highcharts.setOptions({
global: {
useUTC: false
},
credits: {
enabled: false
},
legend: {
enabled: true
}
});
$(function () {
var seriesOptions = [],
seriesCounter = 0,
names = ['user','system'];
/**
* Create the chart when all data is loaded
* @returns {undefined}
*/
function createChart() {
$('#container').highcharts('StockChart', {
/* add */
chart:{
events:{
load:function () {
var ser = [];
for(var i=0;i 0 ? ' + ' : '') + this.value + '%';
}
},
plotLines: [{
value: 0,
width: 2,
color: 'silver'
}]
},
plotOptions: {
series: {
compare: 'percent',
showInNavigator: true
}
},
tooltip: {
pointFormat: '{series.name}: {point.y} ({point.change}%)
',
valueDecimals: 2,
split: true
},
series: seriesOptions
});
}
$.each(names, function (i, name) {
$.getJSON('/api/data?q=' + name.toLowerCase(), function (data) {
seriesOptions[i] = {
name: name,
data: data
};
seriesCounter += 1;
if (seriesCounter === names.length) {
createChart();
}
});
});
});
});
基于多数据列/动态刷新两者改的,但是图标获取的数据只有user是动态刷新,system没有显示
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
人生最曼妙的风景,竟是内心的淡定与从容!