页面树结构

版本比较

标识

  • 该行被添加。
  • 该行被删除。
  • 格式已经改变。

(本文档仅供参考)

问题

堆积柱图上想要柱子的颜色实现渐变的效果,如下截图

Image Modified

解决方案

具体请参考如下扩展属性

代码块
linenumberstrue
{
    "series": [{
        "itemStyle": {
            "normal": {
                "color": {
                    "colorStops": [{
                        "color": "#83bff6",
                        "offset": 0
                    }, {
                        "color": "#188df0",
                        "offset": 0.5
                    }, {
                        "color": "#188df0",
                        "offset": 1
                    }],
                    "global": false,
                    "type": "linear",
                    "x": 0,
                    "x2": 0,
                    "y": 0,
                    "y2": 1
                }
            }
        }
    }, {
        "itemStyle": {
            "normal": {
                "color": {
                    "colorStops": [{
                        "color": "#F57F2D",
                        "offset": 0
                    }, {
                        "color": "#F5A746",
                        "offset": 0.5
                    }, {
                        "color": "#F5DC2D",
                        "offset": 1
                    }],
                    "global": false,
                    "type": "linear",
                    "x": 0,
                    "x2": 0,
                    "y": 0,
                    "y2": 1
                }
            }
        }
    }]
}