echarts- 渐变折线图

11,934次阅读
没有评论

共计 1197 个字符,预计需要花费 3 分钟才能阅读完成。

效果图:echarts- 渐变折线图

需求点:

1. x 轴是时间

2. 折线区域是渐变色

3. 显示折线小圆点

option: {
				tooltip: {
					trigger: 'axis',
					axisPointer: {
						lineStyle: {color: '#57617B'}
					}
				},
				grid: {
					left: '3%',
					right: '4%',
					bottom: '3%',
					containLabel: true
				},
				xAxis: [
					{
						type: 'category',
						boundaryGap: false,
						axisLine: {lineStyle: '#d8d8d8'},
						axisLabel: {textStyle: '#cccccc'},
						splitLine: {
							show: true,
							lineStyle: '#d8d8d8' // x 轴内容线颜色(横线)},
						data: ['07:00', '07:30', '08:00', '08:30', '09:00', '09:30', '10:00', '10:30', '11:00', '11:30', '12:00', '12:30']
					}
				],
				yAxis: [
					{
						type: 'value',
						name: '人数',
						axisTick: {show: false},
						axisLine: {
							show: true,
							lineStyle: '#d8d8d8' // Y 轴坐标颜色
						},
						axisLabel: {
							margin: 10,
							textStyle: '#cccccc'
						},
						splitLine: {
							// 网格线
							lineStyle: {color: '#d8d8d8' // Y 轴内容线颜色(横线)}
						},
						nameTextStyle: {color: '#ffffff', fontSize: 16, padding: [0, 50, 0, 0] }
					}
				],
				series: [
					{
						name: '时间',
						type: 'line',
						symbolSize: 8,
						label: {
							show: true, // 开启显示
							textStyle: {color: '#fff'}
						},
						lineStyle: {
							normal: {color: 'rgba(34, 251, 183, 1)', // 折线颜色
								width: 2,
								shadowColor: 'rgba(34,150,243, 0.3)' // 折线阴影颜色
							}
						},
						itemStyle: {
							normal: {color: 'rgba(34, 251, 183, 1)' // 折线小圆点颜色
							}
						},
						areaStyle: {
							normal: {
								color: new echarts.graphic.LinearGradient(
									0,
									0,
									0,
									1,
									[
										{
											offset: 0,
											color: 'rgba(13, 253, 178, 1)' // 折线底下区域渐变色
										},
										{
											offset: 0.8,
											color: 'rgba(5, 80, 57, 1)' // 折线底下区域渐变色
										}
									],
									false
								)
							}
						},
						data: [0, 200, 167, 142, 85, 121, 186, 243, 162, 137, 0, 0]
					}
				]
			}

原文地址: echarts- 渐变折线图

    正文完
     0
    Yojack
    版权声明:本篇文章由 Yojack 于2024-11-01发表,共计1197字。
    转载说明:
    1 本网站名称:优杰开发笔记
    2 本站永久网址:https://yojack.cn
    3 本网站的文章部分内容可能来源于网络,仅供大家学习与参考,如有侵权,请联系站长进行删除处理。
    4 本站一切资源不代表本站立场,并不代表本站赞同其观点和对其真实性负责。
    5 本站所有内容均可转载及分享, 但请注明出处
    6 我们始终尊重原创作者的版权,所有文章在发布时,均尽可能注明出处与作者。
    7 站长邮箱:laylwenl@gmail.com
    评论(没有评论)