//动态更新图表数据
function getData() {
var categories = [];
$.ajax({
type: "post",
url: "../../ashx/statisPage/XX.ashx",
dataType: "json",
success: function (data) {
var d = [];
$(data).each(function (n, item) {
d.push(item.avgValue);
categories.push(item.sDate);
})
loadContainer(d, categories);
}
});
}
//数据图表展示
function loadContainer(d, categories) {
var chart;
chart = chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'column'
},
title: {
text: ‘1231212’,
x: -20 //center
},
subtitle: {
text: 'Source: WorldClimate.com',
x: -20
},
xAxis: {
categories: []
},
yAxis: {
title: {
text: '渗流量 (m)'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},credits: {
enabled : false
},
tooltip: {
valueSuffix: 'm'
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'middle',
borderWidth: 0
},
series: [{
name: ‘45454545’,
data: []
}]
});
//chart.addSeries({data:[]});
chart.series[0].setData(d);
chart.xAxis[0].setCategories(categories);
}
function getData() {
var categories = [];
$.ajax({
type: "post",
url: "../../ashx/statisPage/XX.ashx",
dataType: "json",
success: function (data) {
var d = [];
$(data).each(function (n, item) {
d.push(item.avgValue);
categories.push(item.sDate);
})
loadContainer(d, categories);
}
});
}
//数据图表展示
function loadContainer(d, categories) {
var chart;
chart = chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'column'
},
title: {
text: ‘1231212’,
x: -20 //center
},
subtitle: {
text: 'Source: WorldClimate.com',
x: -20
},
xAxis: {
categories: []
},
yAxis: {
title: {
text: '渗流量 (m)'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},credits: {
enabled : false
},
tooltip: {
valueSuffix: 'm'
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'middle',
borderWidth: 0
},
series: [{
name: ‘45454545’,
data: []
}]
});
//chart.addSeries({data:[]});
chart.series[0].setData(d);
chart.xAxis[0].setCategories(categories);
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货