首页 > 其他分享 >echarts 曲线图实现 - 下方带阴影渐变效果

echarts 曲线图实现 - 下方带阴影渐变效果

时间:2023-03-06 16:03:29浏览次数:48  
标签:曲线图 show color true 渐变 Math type echarts datas

 

 

 

 

 

 

lineOption5: {
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            type: 'cross',
            label: { color: '#fff' },
            crossStyle: { color: '#6d7882' }
          } /*,
          formatter: function(datas) {
            console.log('datas', datas)
            let res = datas[0].name + '<br/>'
            for (let i = 0, length = datas.length; i < length; i++) {
              res += datas[i].seriesName + ':' + datas[i].value + '%<br/>'
            }
            return res
          }*/
        },
        legend: {
          right: '0%',
          top: '5%',
          data: ['RME', 'RMSG', 'SSP', 'SSPSG'],
          textStyle: { fontSize: 12 },
          show: true
        },
        grid: [
          {
            show: true,
            top: '16%',
            left: '0%',
            right: '0%',
            bottom: '0%',
            containLabel: true
          }
        ],
        xAxis: [
          {
            type: 'category',
            axisLine: {
              lineStyle: {
                color: '#6d7882'
              }
            },
            data: ['1', '2', '3', '4', '5', '6', '7']
          }
        ],
        yAxis: [
          //y轴左侧代表值
          {
            type: 'value',
            name: '',
            position: 'left',
            alignTicks: true,
            splitNumber: 5,
            // min: 0,
            // interval: Math.ceil(Math.ceil(Math.max(100)) / 5),
            // max: Math.ceil(Math.ceil(Math.max(100)) / 5) * 5,
            axisLine: {
              show: false
              /*lineStyle: {
                color: '#d4d7da'
              }*/
            },
            axisLabel: {
              formatter: '{value}'
            }
          }
        ],
        series: [
          {
            name: 'RME',
            type: 'line',
            smooth: true,
            data: [30, 60, 80, 100, 40, 60, 80],
            itemStyle: {
              normal: {
                label: {
                  position: 'bottom'
                  // show: true // 在折线拐点上显示数据
                }
              }
            },
            color: '#3391FF',
            //曲线下方阴影渐变色
            areaStyle: {
              normal: {
                color: {
                  type: 'linear',
                  x: 0,
                  y: 0,
                  x2: 0,
                  y2: 1,
                  colorStops: [
                    {
                      offset: 0,
                      color: 'rgba(14,156,255,0.4)' // 0% 处的颜色
                    },
                    {
                      offset: 1,
                      color: 'rgba(14,156,255,0)' // 100% 处的颜色
                    }
                  ],
                  global: false // 缺省为 false
                }
              }
            }
          },
          {
            name: 'RMSG',
            type: 'line',
            smooth: true,
            data: [23, 10, 30, 77, 90, 100, 60],
            itemStyle: {
              normal: {
                label: {
                  // show: true // 在折线拐点上显示数据
                }
              }
            },
            color: '#55C6D4', //默认颜色
            areaStyle: {
              normal: {
                color: {
                  type: 'linear',
                  x: 0,
                  y: 0,
                  x2: 0,
                  y2: 1,
                  colorStops: [
                    {
                      offset: 0,
                      color: 'rgba(85,198,212,0.4)' // 0% 处的颜色
                    },
                    {
                      offset: 1,
                      color: 'rgba(85,198,212,0)' // 100% 处的颜色
                    }
                  ],
                  global: false // 缺省为 false
                }
              }
            }
          },
          {
            name: 'SSP',
            type: 'line',
            smooth: true,
            data: [],
            itemStyle: {
              normal: {
                label: {
                  // show: true // 在折线拐点上显示数据
                }
              }
            },
            color: '#66CC6A' //默认颜色
          },
          {
            name: 'SSPSG',
            type: 'line',
            smooth: true,
            data: [],
            itemStyle: {
              normal: {
                label: {
                  // show: true // 在折线拐点上显示数据
                }
              }
            },
            color: '#FFDA35' //默认颜色
          }
        ]
      }

 参考:https://blog.csdn.net/qq_42489210/article/details/118099069

标签:曲线图,show,color,true,渐变,Math,type,echarts,datas
From: https://www.cnblogs.com/zqlym/p/17184210.html

相关文章