echarts双折线图

样式如下
在这里插入图片描述
话不多说上案例(案例中已经为大家注释解释清楚代码的具体功能了,不要的可以删改)
(因为自己手打的,本人比较菜可能括号神马的会有报错哦体谅一下)

<template>
	<div>
		<div id="double" style="width: 800px;height: 520px;"></div>//⭐必须写宽高
	</div>
</template>
<script>
export default {
mounted() {this.getDouble()	
	},
methods:{
getDouble() {
				var echart = this.$echarts.init(document.getElementById("double"))//⭐
				var option = {
					title: {},
					tooltip: {
						trigger: 'axis',
						axisPointer: {
							type: 'cross',
						}
					},
					legend: {
						data: ['Direct', 'Search Engine']
					},
					grid: {
						left: '3%',
						right: '4%',
						bottom: '3%',
						containLabel: true
					},
					toolbox: {
						feature: {
							saveAsImage: {}
						}
					},
					xAxis: {
						type: 'category',
						boundaryGap: false,
						data: ['3月', '4月', '5月', '6月', '7月', '8月'],
						axisTick: { //y轴刻度线
							show: false
						},
						//x轴数字颜色
						axisLine: {
							lineStyle: {
								color: '#c1c1c1',
								width: 1, //这里是为了突出显示加上的
							}
						},
					},
					yAxis: {
						type: 'value',
						//多条横线轴颜色
						splitLine: {
							show: true,
							lineStyle: {
								color: ['#315070'],
								width: 1,
								type: 'solid'
							}
						},


						axisLine: {
							lineStyle: {
								color: '#c1c1c1',
								width: 1, //这里是为了突出显示加上的
							}
						},
					},
					grid: {
						left: '3%',
						right: '4%',
						bottom: '10%',
						top: '10%',
						containLabel: true
					},
					series: [{
							name: '注册用户',
							type: 'line',
							stack: 'Total',
							//折点处提示数值
							label: {
								show: true,
								position: 'buttom',
								textStyle: {
									color: "#f85336",
									fontSize: 12
								}
							},
							symbolSize: 2, //折点大小
							data: [200, 120, 90, 150, 170, 180],

							itemStyle: {
								normal: {
									color: '#c23531', //折点颜色
									lineStyle: {
										color: '#c23531' //折线颜色
									}
								}
							},
							//线下阴影
							areaStyle: {
								normal: {
									color: {
										x: 0,
										y: 0,
										x2: 0,
										y2: 1,
										colorStops: [{
											offset: 0,
											color: "#072948" // 0% 处的颜色
										}, {
											offset: 0.7,
											color: "#072948" // 100% 处的颜色
										}],
										globalCoord: false // 缺省为 false
									}
								}
							},

						},
						{
							name: '活跃用户',
							type: 'line',
							//折点处提示数值
							label: {
								show: true,
								position: 'buttom',
								textStyle: {
									color: "#fff",
									fontSize: 12
								}
							},
							stack: 'Total',
							symbolSize: 2, //折点大小
							//折点处提示数值

							data: [100, 220, 180, 210, 120, 120],
							itemStyle: {
								normal: {
									color: '#e5e5e5', //折点颜色
									lineStyle: {
										color: '#fff' //折线颜色
									}
								}
							},
							//线下阴影
							areaStyle: {
								normal: {
									color: {
										x: 0,
										y: 0,
										x2: 0,
										y2: 1,
										colorStops: [{
											offset: 0,
											color: "#689f9d" // 0% 处的颜色
										}, {
											offset: 0.7,
											color: "#689f9d" // 100% 处的颜色
										}],
										globalCoord: false // 缺省为 false
									}
								}
							},
						}
					]
				}
				echart.setOption(option)
			},
	}
}
</script>

在这里插入图片描述

  • 24
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值