TNBLOG
首页
博客
视频
资源
问答
猿趣
手机
关于
搜索
收藏
便签
笔记
消息
创作
登录
剑轩
故如虹,知恩;故如月,知明
博主信息
排名
6
文章
6
粉丝
16
评论
8
文章类别
CSS
15篇
微服务
41篇
Git
14篇
.NET
102篇
移动开发
33篇
软件架构
23篇
.NET Core
119篇
.NET MVC
11篇
英语
3篇
随笔
86篇
Bootstrap
3篇
Redis
21篇
编辑器
10篇
Js相关
15篇
虚拟化
8篇
更多
Oracle
7篇
Python
14篇
数据库
26篇
EF
17篇
微信
3篇
前端
151篇
消息队列
6篇
docker
41篇
多线程
1篇
Java
4篇
软件基础
2篇
C++
2篇
WCF
7篇
Linux
7篇
nginx
5篇
K8S
9篇
ABP
2篇
最新文章
最新评价
{{item.articleTitle}}
{{item.blogName}}
:
{{item.content}}
关于我们
ICP备案 :
渝ICP备18016597号-1
网站信息:
2018-2024
TNBLOG.NET
技术交流:
群号656732739
联系我们:
contact@tnblog.net
欢迎加群
欢迎加群交流技术
原
echart常用折线图,带面积渐变的折线图
3280
人阅读
2020/5/16 21:31
总访问:
3997306
评论:
0
收藏:
0
手机
分类:
前端
### 效果如下: ![](https://img.tnblog.net/arcimg/aojiancc2/0937fdb007924762aa3f12054d39176f.png) **html:** ``` <div class="labroom-trend"> <div class="labroom-trend-title"> 实验完成趋势图 </div> <div class="labroom-trend-content"> <div id="labroom-trend-chart" class="labroom-trend-chart"> </div> </div> </div> ``` **样式也贴一点吧** ``` .labroom-trend { //height: 200px; // background-color: #ffabcd; .labroom-trend-title { font-size: 16px; font-family: MicrosoftYaHei-, MicrosoftYaHei; font-weight: normal; color: #393939; margin-bottom: 10px; } .labroom-trend-chart { // background-color: #ffabcd; height: 255px; width: 100%; } } ``` **js,vue.js** ``` mounted() { this.testChart() }, // 组件方法 methods: { testChart() { // 基于准备好的dom,初始化echarts实例 let myChart = this.$echarts.init(document.getElementById('labroom-trend-chart')) let option = { // 图表颜色设置 color: ['#409EFF', '#00DDFF', '#37A2FF', '#FF0087', '#FFBF00'], // title: { // text: '学习时长趋势(日时长)', // textAlign: 'left', // left: '27px', // top: 10, // textStyle: { // fontSize: '16px', // fontFamily: 'Microsoft YaHei' // } // }, grid: { top: '10%', left: '3%', right: '3%', bottom: '6%', containLabel: true }, xAxis: { type: 'category', data: ['Mon', 'Tue', 'Wed', 'Thu'], //****************不留白,从原点开始************** boundaryGap: false // 不留白,从原点开始 //data: ['Mon', 'Tue', 'Wed', 'Thu',"1","3","5","7","8","9"] }, yAxis: { type: 'value' }, series: [ { data: [32, 51, 41, 49], //data: [32, 51, 41, 49,55,60,30,39,50,22], type: 'line', //显示出来折线图的面积 areaStyle: { normal: { // 颜色渐变函数 前四个参数分别表示四个位置依次为左、下、右、上 color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0, color: 'rgba(80,141,255,0.39)' }, { offset: 0.34, color: 'rgba(56,155,255,0.25)' }, { offset: 1, color: 'rgba(38,197,254,0.00)' }]) } } } ] }; myChart.setOption(option); } } ``` #### 在贴几个渐变颜色组合 **一:** 折线的颜色:#409EFF ``` // 图表颜色设置 color: ['#409EFF'] ``` 渐变色值: ``` // 显示出来折线图的面积 areaStyle: { normal: { // 颜色渐变函数 前四个参数分别表示四个位置依次为左、下、右、上 color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0, color: 'rgba(64,159,255,0.25)' }, { offset: 0.34, color: 'rgba(56,155,255,0.22)' }, { offset: 1, color: 'rgba(38,197,254,0.00)' }]) } } ``` **二:** 折线的颜色:#8AABFF 渐变色值: ``` // 显示出来折线图的面积 areaStyle: { normal: { // 颜色渐变函数 前四个参数分别表示四个位置依次为左、下、右、上 color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0, color: 'rgba(138, 171, 255,0.25)' }, { offset: 0.34, color: 'rgba(35,160,255,0.22)' }, { offset: 1, color: 'rgba(32,126,255,0.00)' }]) } } ``` **三:** 折线的颜色:#31C3F5 渐变色值: ``` // 显示出来折线图的面积 areaStyle: { normal: { // 颜色渐变函数 前四个参数分别表示四个位置依次为左、下、右、上 color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0, color: 'rgba(40, 205, 255,0.25)' }, { offset: 0.34, color: 'rgba(35,215,255,0.22)' }, { offset: 1, color: 'rgba(32,197,254,0.00)' }]) } } ```
欢迎加群讨论技术,1群:677373950(满了,可以加,但通过不了),2群:656732739
👈{{preArticle.title}}
👉{{nextArticle.title}}
评价
{{titleitem}}
{{titleitem}}
{{item.content}}
{{titleitem}}
{{titleitem}}
{{item.content}}