Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.6k views
in Technique[技术] by (71.8m points)

echarts bar3D 怎么设置渐变色?

看了官网的文档,上面说 color 的值可以是一个 Function:
image.png
我用了如下的渐变色代码:

color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
  offset: 0,
  color: '#508DFF'
  }, {
  offset: 1,
  color: '#26C5FE'
}]),

进行设置,但是不起作用。
bar3D 完整代码如下:

{
    type: 'bar3D',
    minHeight: 30,
    coordinateSystem: 'geo3D',
    bevelSize: 1,
    // bevelSmoothness: 50,
    itemStyle: {
        // color: [0.3, 0.8, 1, 1],
        color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
            offset: 0,
            color: '#508DFF'
        }, {
            offset: 1,
            color: '#26C5FE'
        }]),
        // opacity: 1
    },
    shading: 'lambert',
    data: barData,
    label: {
        show: true,
        formatter: function (params) {
            return params.name + '
' + params.value[2];
        }
    }
}

希望各位大神指导一下,不胜感激???


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...