Toggle navigation
多维度柱状图
By
残月下的面具
2018-03-19 07:49:30
脚本
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
图表已生成
整理代码
刷新
代码
var tgtVals = [1400, 1300, 1600, 1700, 2000, 3000, 2600, 4560, 2560, 2600]; var compVals = [1420, 1320, 1590, 1730, 2020, 3100, 2700, 4600, 2566, 2660]; var areas = ['北京','天津','河北','辽宁','上海','浙江','江苏','广东','江西','安徽']; var dataLen = tgtVals.length; var compPcts = []; var incPcts = [3, 2, 5, 2, 3, 6, 4, 8, 5, 6]; tgtVals.forEach(function(item, index){ compPcts.push((compVals[index] / item * 100).toFixed(2)); }); option = { title : { text: '合同整体完成情况统计', //主标题 subtext: '纯属虚构', //副标题 x: 'center' //标题位置 }, //图表标题 tooltip : { trigger: 'axis' }, toolbox: { feature: { dataZoom: { yAxisIndex: 'none' }, //放缩功能 dataView: {show: true, readOnly: false}, //清单功能 magicType: {show: true, type: ['line', 'bar']}, //柱形/折线切换功能 restore: {show: true}, //刷新功能 saveAsImage: {show: true} //下载功能 } }, calculable : true, legend: { data:['目标','完成情况', '完成率', '同比增长'], left:10, }, xAxis : [ { type : 'category', data : areas, axisTick: { alignWithLabel: true, //刻度线和标签对齐 interval:0 //间隔 }, splitLine: { show: true, //网格线开关 }, }, ], yAxis : [ { type : 'value', name : '金额(万元)', max:5000, // axisLabel : { // formatter: '{value} ml' // }, splitLine: { // 分隔线 show: false, // 默认显示,属性show控制显示与否 }, axisLine: { show: true // 坐标轴是否显示 }, axisTick: { show: true //坐标轴刻度线是否显示 }, splitLine: { show: true, //网格线开关 } }, { type : 'value', name : '百分比', // axisLabel : { // formatter: '{value} °C' // }, splitLine: { // 分隔线 show: false, // 默认显示,属性show控制显示与否 }, axisLine: { show: true }, axisTick: { show: false }, splitLine: { show: false, } } ], series : [ { name:'目标', type:'bar', data: tgtVals, markLine: { data:[{ type: 'average' }] }, itemStyle: { normal: { //barBorderRadius: 15, color: new echarts.graphic.LinearGradient( 0, 0, 0, 1, [{ offset: 0, color: 'green' }, { offset: 1, color: 'green' } ] ) } } }, { name:'完成情况', type:'bar', data: compVals, markLine: { data:[{ type: 'average' }], label: { position: 'start' } }, itemStyle: { normal: { //barBorderRadius: 15, color: new echarts.graphic.LinearGradient( 0, 0, 0, 1, [{ offset: 0, color: '#a04800' }, { offset: 1, color: '#a04800' } ] ) } }, } ] };