程序员最近都爱上了这个网站  程序员们快来瞅瞅吧!  it98k网:it98k.com

本站消息

站长简介/公众号

  出租广告位,需要合作请联系站长


+关注
已关注

分类  

暂无分类

标签  

暂无标签

日期归档  

echart 横向柱状图(进度条模式的)

发布于2021-11-20 17:41     阅读(2474)     评论(0)     点赞(5)     收藏(0)


getChartBarHeng(id, xData, yData) { //横向柱状图
	let that = this;
	let echarts = that.$echarts;
	var chartDom = document.getElementById(id);
	var myChart = echarts.init(chartDom);
	var option;
	option = {
		tooltip: {
			axisPointer: {
				type: "shadow",
			},
		},
		grid: {
			top: '3%',
			left: "3%",
		},
		xAxis: {
			type: 'value',
			splitLine: {
				show: false //去掉辅助线
			},
			axisLine: {
				show: false,
			},
			axisLabel: {
				show: false,
			}

		},
		yAxis: {
			type: 'category',
			data: yData,
			splitLine: {
				show: false //去掉辅助线
			},
			axisLine: {
				show: false,
			},
			axisTick: {
				show: false
			},
			axisLabel: {
				inside: true,
				margin: 0,
				textStyle: {
					color: '#fff', //值的颜色
					fontSize: 16,
					verticalAlign: "bottom",
					align: "left",
					padding: [0, 0, 10, 0],
				},
			}
		},
		series: [{
			data: xData,
			type: 'bar',
			showBackground: true,
			backgroundStyle: {
				color: '#253E7D',
				borderRadius:5
			},
			barWidth: 10,
			itemStyle: {
				normal: {
					color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
							offset: 0,
							color: '#39ACE2'
						},
						{
							offset: 1,
							color: '#14FCFC'
						}
					], false),
					barBorderRadius: [5, 5, 5, 5],
				}
			},
			label: {
				normal: {
					show: true,
					position: [430, -20],   //value的位置
					color: '#fff', //值的颜色
					fontSize: 16,
				}
			}
		}]
	};
  option && myChart.setOption(option);
 }

效果图
在这里插入图片描述




所属网站分类: 技术文章 > 博客

作者:Bhbvhbbgg

链接:http://www.qianduanheidong.com/blog/article/237589/4f8bc25839b694a0c12c/

来源:前端黑洞网

任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任

5 0
收藏该文
已收藏

评论内容:(最多支持255个字符)