Toggle navigation
条形图重叠
By
疾***子
2020-08-21 08:16:46
脚本
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 = { backgroundColor: '#000', grid: { top: '10%', // right: 15, left: 'left', bottom: 0, containLabel: true }, color: ['#3f9e97', '#00817e'], textStyle: { color: 'rgba(255, 255, 255, 0.9)' }, tooltip: { trigger: 'axis', axisPointer: { type: 'shadow', }, textStyle: { fontSize: 14 }, formatter: function(params, ticket, callback) { // console.log(params); ////可以打印出来看看数据结构哦 let axisValueLabel = params[0].axisValueLabel let sumVal = 0; let src = axisValueLabel + '
'; for (x in params) { sumVal += Number(params[x].value) src += params[x].marker + params[x].seriesName + ": " + params[x].value + '
'; } src += params[x].marker + '补偿总电量' + ": " + sumVal + '
'; return src }, }, legend: [{ itemWidth: 35, itemHeight: 10, formatter: (name) => { return name }, data: [{ name: '蒸发量', icon: 'roundRect', textStyle: { fontSize: 14, color: 'rgba(255, 255, 255, 0.9)' }, }, ], top: '4%', align: 'right', right: '30%', //调整位置 // orient: 'vertical', // x: 'right',//图例位置 // y: 'center'//延Y轴居中 }, { itemWidth: 35, itemHeight: 10, formatter: (name) => { return name }, data: [{ name: '降水量', icon: 'roundRect', textStyle: { fontSize: 14, color: 'rgba(255, 255, 255, 0.9)' } }], top: '4%', align: 'right', right: '10%', //调整位置 // orient: 'vertical', // x: 'right',//图例位置 // y: 'center'//延Y轴居中 }, ], yAxis: [{ type: 'category', data: ['塘寨发电', '构皮滩', '大方发电', '大龙发电', '毕节热电', '桐梓发电', '索风营', '沙陀', '东方', '乌江渡', '格里桥', '大花水', '思林', '洪家渡'], axisPointer: { type: 'shadow' }, axisLabel: { formatter: '{value}', fontSize: 14 }, "axisTick": { //y轴刻度线 "show": false }, "splitLine": { //网格线 "show": false } }, ], xAxis: [{ type: 'value', // name: '水量', // min: 0, // max: 250, // interval: 50, splitNumber: 4, //最少分段数4 axisLabel: { formatter: '{value}', fontSize: 14 }, "axisTick": { //y轴刻度线 "show": false }, "splitLine": { //网格线 "show": false } }], series: [{ name: '蒸发量', type: 'bar', label: { show: true, position: 'insideRight', textStyle: { fontSize: 14 }, }, zlevel: 3, data: [200, 300, 200, 500, 600, 300, 200, 400, 200, 500, 300, 200, 300, 200] }, { name: '降水量', type: 'bar', label: { show: true, position: 'insideRight', textStyle: { fontSize: 14 }, }, barGap: '-100%', //添加此配置项即为重叠效果 zlevel: 2, data: [800, 900, 1000, 1200, 1500, 1400, 1700, 1800, 700, 1300, 600, 800, 700, 600] }, ] };