Toggle navigation
- - 逐年柱状对比图
By
S***七
2017-07-07 09:25:53
脚本
16
21
作品使用的第三方脚本
数据管理
上传数据
支持小于 5M 任意格式(csv, xlsx, json, xml, ...)的数据文件
上传后可以通过生成的文件链接异步获取托管的数据。
历史数据
0 条
无历史数据
代码修改记录
信息提示
保存作品
对当前截图不满意?你还可以
上传本地截图
重新截图
作品名称
作品描述
标签
geo
grid
legend
markLine
markPoint
bar
effectScatter
line
lines
map
timeline
title
toolbox
tooltip
visualMap
作品默认版本
最新
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
20:11:45
图表已生成
整理代码
刷新
代码
option = { title: { text: 'Awesome Chart' }, xAxis: { data: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'] }, yAxis: {}, series: [{ type: 'line', data:[220, 182, 191, 234, 290, 330, 310] }] }; var myData = ['彝族', '德昂族', '哈尼族', '傣族', '壮族', '苗族', '傈僳族', '拉祜族', '佤族', '纳西族', '瑶族', '景颇族', '布依族', '布朗族', '阿昌族', '独龙族']; var databeast = { 2006: [389, 259, 262, 324, 232, 176, 196, 214, 133, 370, 268, 360, 185, 392, 392, 153], 2007: [111, 315, 139, 375, 204, 352, 163, 258, 385, 209, 209, 243, 204, 352, 163, 258], 2008: [227, 210, 328, 292, 241, 110, 130, 185, 392, 392, 153, 187, 150, 200, 250, 300], 2009: [100, 350, 300, 250, 200, 150, 100, 150, 200, 250, 300, 350, 400, 350, 300, 250], 2010: [280, 128, 255, 254, 313, 143, 360, 343, 338, 163, 333, 317, 263, 302, 372, 163], 2011: [121, 388, 233, 309, 133, 308, 297, 283, 349, 273, 229, 238, 224, 291, 185, 203], 2012: [200, 350, 300, 250, 200, 150, 100, 150, 200, 250, 300, 350, 400, 350, 300, 250], 2013: [380, 129, 173, 101, 310, 393, 386, 296, 366, 268, 208, 149, 356, 239, 208, 330], 2014: [363, 396, 388, 108, 325, 120, 180, 292, 200, 309, 223, 236, 209, 271, 215, 216], 2015: [300, 350, 300, 250, 200, 150, 100, 150, 200, 250, 300, 350, 400, 350, 300, 250], 2016: [100, 350, 300, 250, 200, 150, 100, 150, 200, 250, 300, 350, 400, 350, 300, 250], 2017: [280, 128, 255, 254, 313, 143, 360, 343, 338, 163, 333, 317, 263, 302, 372, 163], }; var databeauty = { 2006: [121, 388, 233, 309, 133, 308, 297, 283, 349, 273, 229, 238, 224, 291, 185, 203], 2007: [200, 350, 300, 250, 200, 150, 100, 150, 200, 250, 300, 350, 400, 350, 300, 250], 2008: [380, 129, 173, 101, 310, 393, 386, 296, 366, 268, 208, 149, 356, 239, 208, 330], 2009: [363, 396, 388, 108, 325, 120, 180, 292, 200, 309, 223, 236, 209, 271, 215, 216], 2010: [300, 350, 300, 250, 200, 150, 100, 150, 200, 250, 300, 350, 400, 350, 300, 250], 2011: [100, 350, 300, 250, 200, 150, 100, 150, 200, 250, 300, 350, 400, 350, 300, 250], 2012: [280, 128, 255, 254, 313, 143, 360, 343, 338, 163, 333, 317, 263, 302, 372, 163], 2013: [389, 259, 262, 324, 232, 176, 196, 214, 133, 370, 268, 360, 185, 392, 392, 153], 2014: [111, 315, 139, 375, 204, 352, 163, 258, 385, 209, 209, 243, 204, 352, 163, 258], 2015: [227, 210, 328, 292, 241, 110, 130, 185, 392, 392, 153, 187, 150, 200, 250, 300], 2016: [100, 350, 300, 250, 200, 150, 100, 150, 200, 250, 300, 350, 400, 350, 300, 250], 2017: [280, 128, 255, 254, 313, 143, 360, 343, 338, 163, 333, 317, 263, 302, 372, 163], }; var timeLineData = [2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017]; option = { baseOption: { backgroundColor: '#000', timeline: { show: true, axisType: 'category', tooltip: { show: true, formatter: function(params) { console.log(params); return params.name + '年数据统计'; } }, autoPlay: true, currentIndex: 6, playInterval: 1000, label: { normal: { show: true, interval: 'auto', formatter: '{value}年', }, }, data: [], }, title: { // text:'少数民族帅哥美女统计', textStyle: { color: '#fff', fontSize: 16, }, subtext: '云南特有16个少数民族', }, legend: { data: ['帅哥', '美女'], top: 4, right: '10%', textStyle: { color: '#fff', }, }, tooltip: { show: true, trigger: 'axis', formatter: '{b}
{a}: {c}人', axisPointer: { type: 'shadow', } }, toolbox: { feature: { dataView: { show: true, readOnly: false }, restore: { show: true }, saveAsImage: { show: true } } }, grid: [{ show: false, left: '4%', top: 60, bottom: 60, containLabel: true, width: '46%', }, { show: false, left: '50.5%', top: 80, bottom: 60, width: '0%', }, { show: false, right: '4%', top: 60, bottom: 60, containLabel: true, width: '46%', }, ], xAxis: [ { type: 'value', inverse: true, axisLine: { show: false, }, axisTick: { show: false, }, position: 'top', axisLabel: { show: true, textStyle: { color: '#B2B2B2', fontSize: 12, }, }, splitLine: { show: true, lineStyle: { color: '#1F2022', width: 1, type: 'solid', }, }, }, { gridIndex: 1, show: false, }, { gridIndex: 2, type: 'value', axisLine: { show: false, }, axisTick: { show: false, }, position: 'top', axisLabel: { show: true, textStyle: { color: '#B2B2B2', fontSize: 12, }, }, splitLine: { show: true, lineStyle: { color: '#1F2022', width: 1, type: 'solid', }, }, }, ], yAxis: [{ type: 'category', inverse: true, position: 'right', axisLine: { show: false }, axisTick: { show: false }, axisLabel: { show: false, margin: 8, textStyle: { color: '#D9EA0', fontSize: 12, }, }, data: myData, }, { gridIndex: 1, type: 'category', inverse: true, position: 'left', axisLine: { show: false }, axisTick: { show: false }, axisLabel: { show: true, textStyle: { color: '#8D9EA0', fontSize: 12, }, }, data: myData.map(function(value) { return { value: value, textStyle: { align: 'center', } } }), }, { gridIndex: 2, type: 'category', inverse: true, position: 'left', axisLine: { show: false }, axisTick: { show: false }, axisLabel: { show: false, textStyle: { color: '#8D9EA0', fontSize: 12, }, }, data: myData, }, ], series: [], }, options: [], }; for (var i = 0; i < timeLineData.length; i++) { option.baseOption.timeline.data.push(timeLineData[i]); option.options.push({ title: { text: '少数民族' + timeLineData[i] + '各地少数民族帅哥美女统计', }, series: [{ name: '帅哥', type: 'bar', barGap: 20, barWidth: 20, label: { normal: { show: false, }, emphasis: { show: true, position: 'left', offset: [0, 0], textStyle: { color: '#fff', fontSize: 14, }, }, }, itemStyle: { normal: { color: '#559F83', }, emphasis: { color: '#08C7AE', }, }, data: databeast[timeLineData[i]], }, { name: '美女', type: 'bar', barGap: 20, barWidth: 20, xAxisIndex: 2, yAxisIndex: 2, label: { normal: { show: false, }, emphasis: { show: true, position: 'right', offset: [0, 0], textStyle: { color: '#fff', fontSize: 14, }, }, }, itemStyle: { normal: { color: '#F58989', }, emphasis: { color: '#F84646', }, }, data: databeauty[timeLineData[i]], } ] }); }