码迷,mamicode.com
首页 > 其他好文 > 详细

highchart柱状堆叠图动态数据请求

时间:2017-03-16 21:49:55      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:eww   shadow   需求   order   theme   gen   for   console   data   

$(function () {
var options = {
chart: {
renderTo: ‘indoor‘,
type: ‘column‘,
},
title: {
text: ‘室内问题‘
},
xAxis: {
categories: [‘MR弱覆盖楼宇‘, ‘高2无4‘, ‘2G高倒挂‘, ‘投诉‘, ‘保障需求‘, ‘市场需求‘],
labels: {
rotation:0
}
},
yAxis: {
max: 1000,
min: 0,
title: {
text: ‘‘
},
stackLabels: {
enabled: true,
style: {
fontWeight: ‘bold‘,
color: (Highcharts.theme && Highcharts.theme.textColor) || ‘gray‘
}
}
},
legend: {
align: ‘right‘,
x: -30,
verticalAlign: ‘top‘,
y: 25,
floating: true,
backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || ‘white‘,
borderColor: ‘#CCC‘,
borderWidth: 1,
shadow: false
},
tooltip: {
formatter: function () {
return ‘<b>‘ + this.x + ‘</b><br/>‘ +
this.series.name + ‘: ‘ + this.y + ‘<br/>‘ +
‘Total: ‘ + this.point.stackTotal;
}
},
plotOptions: {
column: {
pointWidth:‘30‘,
stacking: ‘normal‘,
dataLabels: {
enabled: true,
color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || ‘white‘,
style: {
textShadow: ‘0 0 3px black‘
}
}
}
},
series: [{
name: ‘已提方案‘,
data: [],
color: ‘#FFA500‘
}, {
name: ‘待提方案‘,
data: [],
color: ‘#228B22‘
}]
};
var newWithoutDemand =[];
var newWithDemand =[];

$.ajax({
url: ‘/Public/StatIssueByBranch?BranchID=1&CellularTypeID=2‘,
type: ‘GET‘,
dataType: ‘json‘,
success: function (data) {
for(var i=0;i<data.length;i++){
newWithoutDemand.push(data[i].WithoutDemand);
newWithDemand.push(data[i].WithDemand);
}
console.log(‘###‘)
var obj = newWithDemand;
var obj1 = newWithoutDemand;
options.series[0].data = obj;
options.series[1].data = obj1;


console.log(obj)
console.log(obj1)

chart = new Highcharts.Chart(options);   //这里顶部chart



},
error: function () {
console.log(error)
}
});
});

highchart柱状堆叠图动态数据请求

标签:eww   shadow   需求   order   theme   gen   for   console   data   

原文地址:http://www.cnblogs.com/lxl0419/p/6561582.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!