echarts 在vue中配置渐变折线图

1 篇文章 0 订阅

效果图
在这里插入图片描述

直接上代码

option = {
          title: {
            text: '平台收入统计',
            x: 'center',//水平安放位置,默认为'left',可选为:'center' | 'left' | 'right' | {number}(x坐标,单位px)
            textAlign: "center",//水平对齐方式,默认根据x设置自动调整,可选为: left' | 'right' | 'center
            textStyle: {
              //主标题文本样式
              fontSize: 16,
              fontStyle: 'normal',
              fontWeight: 'normal',
              color: "#333333"
            },
          },
          tooltip: {
            trigger: 'axis',
            showContent: false
          },
          xAxis: {
            type: 'category',
            scale: true,
            axisTick: {       //x轴刻度线是否显示
              show: false
            },
            axisLine: {
              lineStyle: {
                // 设置x轴颜色
                color: '#666666',
                width: 0, //x轴 是否显示
                type: 'dotted', //'dotted'虚线 'solid'实线
              }
            },
            // 设置X轴数据旋转倾斜
            boundaryGap: true,
            data:["19-05","19-08"] //日期数据源
          },
          yAxis: {
            type: 'value',
            axisTick: {       //y轴刻度线是否显示
              show: false
            },
            axisLine: {
              lineStyle: {
                // 设置y轴颜色
                color: '#666666',
                width: 0, //y轴 是否显示
              }
            },
          },
          //边距调整
          grid: {
            x: 40,
            x2: 20,
            y: 12,
          },
          series: [{
            data: [12,123], //总数数据源,
            type: 'line',
            smooth: true,
            seriesLayoutBy: 'row',
            // 设置折线上圆点大小
            symbolSize: 8,
            areaStyle: {  //覆盖区域的渐变色
              normal: {
                // color: '#091e3b', //改变区域颜色
                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                    offset: 0, color: '#0F89D7' // 0% 处的颜色
                  }, {
                    offset: 0.5, color: '#29BFF7' // 100% 处的颜色
                  }, {
                    offset: 1, color: '#fff' // 100% 处的颜色
                  }]
                ),  //背景渐变色
              }
            },
            itemStyle: {
              normal: {
                // 拐点上显示数值
                label: {
                  show: true
                },
                borderColor: '#0FA8E1', // 拐点边框颜色
                color: "#0FA8E1",
                lineStyle: {
                  width: 3, // 设置线宽
                  type: 'solid' //'dotted'虚线 'solid'实线
                }
              }
            }
          }],
        };
  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值