Toggle navigation
柱状图与坐标轴有间距
By
陌若安生014
2018-08-22 03:13:58
脚本
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 option = { backgroundColor:'#12234F', title: { text: '', }, // tooltip: { // trigger: 'axis', // axisPointer: { // type: 'shadow' // } // }, tooltip: { trigger: 'item', formatter: "{b}
{c}
平方米", }, grid: { top:'3%', left: '8%', right: '8%', bottom: '6%', containLabel: true }, xAxis: { type: 'value', boundaryGap: [0, 0.01], min:0, max:100000, splitNumber:5, axisLine:{ lineStyle:{ color:'white' } }, splitLine: { show: false, }, axisLabel:{ //fontWeight:10, fontsize:2, align:'center', interval:0, }, axisTick: { show: false },//隐藏刻度条 // name:'平方米', // nameLocation:'end', // nameTextStyle:{ // color:"#8d8d8d", // fontSize:16, // padding:[30,0,0] // } }, yAxis: { type: 'category', data: ['A-02','A-04','A-06','A-08','A-09'], axisLine:{ lineStyle:{ color:'#ffffff', width:'2', } }, axisLabel:{ interval: 0, margin:10 }, axisTick:{ show:false }, // name:'地块名', // nameLocation:'end', // nameGap:-5, // nameTextStyle:{ // color:"#8d8d8d", // fontSize:16, // padding:[0,55,0,0] // } }, //series[0]即"辅助"这个series,将itemStyle的color和barBorderColor设为 //rgba(0,0,0,0),即透明,data的数据设置一样的,这样在视觉的效果上第二个柱子 //会和坐标轴有间距. series: [ { name: "辅助", type: "bar", stack: "总", barWidth: 20, itemStyle: { normal: { barBorderColor: 'rgba(0,0,0,0)', color: 'rgba(0,0,0,0)' } }, data: [15000,15000, 15000, 15000,15000] }, { name: '', type: 'bar', stack: "总", data: [ 95726.02, 54330.88, 36242.56, 35797.86, 24169.19], barWidth: '20', itemStyle:{ normal:{ //设置渐变色及圆角 //barBorderRadius: 7, color: new echarts.graphic.LinearGradient( 0, 0, 1, 0, [ {offset: 0, color: '#00a9ec'}, {offset: 1, color: '#00acf0'} ] ) } }, //为柱状添加顶部显示 label: { normal: { show: true, position: "insideRight", padding:[0,10,0,0], offset: [5, 0], textStyle: { color: '#FFFFFF', fontSize: 12 } } }, }, ], };