折线统计图实现渐变色

使用了echats插件

官网:https://echarts.apache.org/zh/index.html

渐变色官网实例:https://echarts.apache.org/examples/zh/editor.html?c=line-tooltip-touch

其他官网实例:https://echarts.apache.org/examples/zh/index.html

我做的实现效果图:

 引入echats和上手绘制,请先移步这里,(我也是刚学)https://echarts.apache.org/zh/tutorial.html#5%20%E5%88%86%E9%92%9F%E4%B8%8A%E6%89%8B%20ECharts

 存放图表位置:

<div class="history">
      <div ref="chart" class="chart" />
 </div>

 style:

.chart {
      width: 100%;
      height: 208px;
    }

然后引入: import echarts from 'echarts'

 chart: {
            element: null,
            option: {
              grid: {
                left: 15,
                right: 24,
                bottom: 0,
                top: 10,
                containLabel: true
              },
              tooltip: {
                trigger: 'axis'
              },
              xAxis: {
                type: 'category',
                data: ['4/18 0h', '4/18 1h', '4/18 2h', '4/18 3h', '4/18 4h', '4/18 5h', '4/18 6h', '4/18 7h',
                  '4/18 8h', '4/18 9h', '4/18 10h', '4/18 11h'
                ],
                //data: ['4/18 0h', '4/18 1h', '4/18 2h', '4/18 3h', '4/18 4h', '4/18 5h', '4/18 6h', '4/18 7h', '4/18 8h', '4/18 9h', '4/18 10h', '4/18 11h', '4/18 12h', '4/18 13h', '4/18 14h', '4/18 15h', '4/18 16h', '4/18 17h', '4/18 18h', '4/18 19h', '4/18 20h', '4/18 21h', '4/18 22h', '4/18 23h']
              },
              yAxis: {
                type: 'value',
                scale: true,
                minInterval: 10,
                splitLine: {
                  show: false
                }
              },
              series: [{
                color: "#5A8CE9",
                name: '',
                type: 'line',
                showSymbol: false,
                hoverAnimation: false,
                data: [],
                //实现折线统计图阴影两种颜色有深入浅
                areaStyle: {
                  color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                    offset: 0,
                    color: '#5A8CE9'
                  }, {
                    offset: 1,
                    color: '#ffe'
                  }])
                },
              }],
              // 阴影

            }
          }

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值