Vue项目使用echarts内置渐变色函数,报错如下:?

报错:

Failed to execute 'addColorStop' on 'CanvasGradient': The value provided ('rgba (11, 168, 44, 0)') could not be parsed as a color.

代码:

areaStyle: {
            color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [
              {
                offset: 0,
                color: colorArr1[index]
              },
              {
                offset: 1,
                color: colorArr2[index]
              }
            ])
          }
阅读 4.9k
3 个回答

image.png
colorArr1数组中的颜色用16位的编码比如#ffffff, 不用rgba

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏