echarts 实现y轴位置任意偏移--x轴原理相同
业务场景:多拼接横向柱状图y轴名称偏移
直接上代码
option = {tooltip: {trigger: 'axis',axisPointer: { // Use axis to trigger tooltiptype: 'shadow' // 'shadow' as default; can also be 'line' or 'shadow'}},legend: {show:false,data: ['Direct', 'Mail Ad', 'Affiliate Ad', 'Video Ad', 'Search Engine']},grid: {left: '3%',right: '4%',bottom: '3%',containLabel: true},xAxis: {show:false,type: 'value',},yAxis: {type: 'category',data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],left:'20%',top:'80%',axisTick: {//刻度线show: false},axisLine:{lineStyle:{width:0,}},axisLabel:{textStyle:{color:"#fff"},verticalAlign: 'bottom', //看这里align:'right',//看这里//调整文字上右下左padding: [0,-80,15,0],//看这里
}},series: [{name: 'Direct',type: 'bar',stack: 'total',label: {show: false},emphasis: {focus: 'series'},barWidth:10,data: [320, 302, 301, 334, 390, 330, 320]},{name: 'Mail Ad',type: 'bar',stack: 'total',label: {show: false},emphasis: {focus: 'series'},data: [120, 132, 101, 134, 90, 230, 210]},{name: 'Affiliate Ad',type: 'bar',stack: 'total',label: {show: false},emphasis: {focus: 'series'},data: [220, 182, 191, 234, 290, 330, 310]},{name: 'Video Ad',type: 'bar',stack: 'total',label: {show: false},emphasis: {focus: 'series'},data: [150, 212, 201, 154, 190, 330, 410]},{ name: 'Search Engine',type: 'bar',stack: 'total',label: {show: false},emphasis: {focus: 'series'},data: [820, 832, 901, 934, 1290, 1330, 1320]}]
};

灵感来源:https://blog.csdn.net/zhengTornado/article/details/110879684(做的进度条效果)
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
