<div id="container" style="min-width:700px;height:400px"></div>
#javascript#

$("#container").highcharts({
chart: {
type: 'column'
},
credits: {//去掉 highcharts.com
enabled:false
},
colors: ['#7cb5ec','#434348', '#90ed7d', '#f7a35c', '#8085e9','#f15c80', '#e4d354', '#8085e8', '#8d4653', '#91e8e1'],
title: {
text: '平台品牌数据',
style:{
color:'#8085e8'
}
},
subtitle: {
text: '电子商务公司'
},
xAxis: {
categories: []
},
yAxis: {
min: 0,
title: {
text: 'Rainfall (个)'
}
},
tooltip: {
headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
'<td style="padding:0"><b>{point.y:.1f} 个</b></td></tr>',
footerFormat: '</table>',
shared: true,
useHTML: true
},
plotOptions: {
column: {
pointPadding: 0.2,
borderWidth: 0
}
},
series: []
}); // 动态获取数据并设置
$.ajax({
type: 'get',
url: '<?php echo site_url()?>/analysesdata/Brandarea/test',
data: '',
dataType: 'json',
success: function (data) { var brand = new Array();
brand = ("招商,善融,建行,工商,民生,淘宝,邮乐,一卡通").split(',');
console.info(brand); //设置统计数据
var brand_chart = $("#container").highcharts(); //设置x轴数据
brand_chart.xAxis[0].setCategories(['苹果', '三星', '小米', '华为', '魅族']); //设置柱状图数据
var i=0;
$.each(brand,function (key, val) { //设置 X 数据
brand_chart.addSeries({name:val,data:eval("([" + data[val] + "])")});
//alert(brand_chart.series[i].name);
//brand_chart.series[i].setData(eval("([" + data[val] + "])")); i++;
}); // brand_chart.series[i].setData(eval("([" + data['招商'] + "])"));
//brand_chart.series[0].setData(eval("([60, 71.15, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4])")); } });
静态设置series数据 :X轴
 series: [    {
                name: '招商',
data: [],
dataLabels: {
enabled: true,
rotation: -90,
color: '#90ed7d',
align: 'top',
x: 4,
y: -10,
style: {
fontSize: '10px',
fontFamily: 'Verdana, sans-serif',
textShadow: '0 0 0px black'
}
} }, {
name: '善融',
data: [83.6, 78.8, 98.5, 93.4, 106.0] }, {
name: '建行',
data: [48.9, 38.8, 39.3, 41.4, 47.0]
}, {
name: '工商',
data: [42.4, 33.2, 34.5, 39.7, 52.6],
dataLabels: {
enabled: true,
rotation: -90,
color: '#666666',
align: 'top',
x: 4,
y: -10,
style: {
fontSize: '10px',
fontFamily: 'Verdana, sans-serif',
textShadow: '0 0 0px black'
}
} },{
name:'民生',
data:[]
},{
name:'淘宝',
data:[]
},{
name:'邮乐',
data:[]
},{
name:'一卡通',
data:[]
}
]

最新文章

  1. 线段树单点更新poj 2828
  2. 【Linux高级驱动】LCD logo
  3. Web性能优化之动态合并JS/CSS文件并缓存客户端
  4. 20160729noip模拟赛zld
  5. MapReduce在Map端的Combiner和在Reduce端的Partitioner
  6. Nginx 变量漫谈(七)
  7. ARM Cortex-M3内核的巨大优势
  8. 关闭Sublime Text的自动更新的方法
  9. 虚拟机安装macos 分辨率不正常修改不了,不能全屏如何解决
  10. HashMap深度解析
  11. Nginx:论高并发,在座各位都是渣渣
  12. sqlmap注入分类
  13. Maya学习笔记
  14. bzoj1511 [POI2006]OKR-Periods of Words kmp+乱搞
  15. AI实现五子棋机器人(一)
  16. 【知识碎片】 Linuxb 篇
  17. Hadoop Sentry 学习
  18. Opencv Laplacian(拉普拉斯算子)
  19. 1g免费空间永久使用
  20. 【codeforces 731E】Funny Game

热门文章

  1. hihocoder #1300 : 展胜地的鲤鱼旗 dp
  2. CSS透明属性详解代码
  3. 使用node的http模块实现爬虫功能,并把爬到的数据存入mongondb
  4. The 10th Zhejiang Provincial Collegiate Programming Contest
  5. spoj 78
  6. 消除SDK更新时的“https://dl-ssl.google.com refused”异常
  7. PHPStorm 3.0 与服务器端代码同步配置
  8. POJ 2948 Martian Mining(DP)
  9. String类的使用 Part2
  10. NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.