本文档仅供参考

问题

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

解决方案

具体请参考如下扩展属性

{

    "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

                }

            }

        }

    }]

}