echarts 显示一条与y轴平行的线

设置基准线

显示一条与y轴平行的线

var option = {
		title: {
			// text: 'Summary By Personnel'
		},
		// visualMap: {
		// 	show: true,
		// 	pieces: [{
		// 		gt: 0,
		// 		lte: 3, //这儿设置基线上下颜色区分 基线下面为绿色
		// 		color: '#03d6d6'
		// 	}, {

		// 		gt: 3, //这儿设置基线上下颜色区分 基线上面为红色
		// 		color: '#e91642'
		// 	}]
		// },
		legend: {
			// Try 'horizontal'
			// orient: 'vertical',
			right: 10,
			top: '10px',
			data: legendData //
		},
		tooltip: {
			trigger: 'axis',
			axisPointer: {
				type: 'shadow'
			}
		},
		dataset: {
			source: dataSource//显示的数据,[[name,val,val],[name,val,val]]
		},
		xAxis: {
			type: 'category',
			axisLabel: {
				interval: -30,
				rotate: 30, //倾斜的程度
			}
		},
		yAxis: {
			type: 'value'
		},
		series: []
	};
	
//*重点
//显示与y轴平行的线
legendData.filter((item, index) => {/循环
			option.series.push({
				name: item,
				type: 'line',
				// barWidth: 15,
				label: {
					show: true,
					position: 'top',
				},
				markLine: {
					symbol: ['none', 'none'], //去掉箭头
					silent: true,
					lineStyle: {
						normal: {
							type: 'solid',//直线
							color: '#ff0000' // 这儿设置安全基线颜色
						}
					},
					data: [
						{
							yAxis: markprice,
						},
					],
					label: {
						show: true,
						//position: 'insideStartBottom',
						color: 'rgb(91, 155, 213)',
						normal: {
							ormatter: 'insideStartBottom'           ,// 这儿设置安全基线  显示的内容 insideStartBottom表示显示基准线的大小,可以自定义
							}

					},
				}
			})
		});
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值