(本文档仅供参考)
问题
电子表格或自助仪表盘上希望实现面积图颜色渐变,如下截图
解决方案
V9版本的自助仪表盘中,具体请参考如下扩展属性
"series": [{ "areaStyle": { "normal": { "color": { "x": 0, "y": 0, "x2": 0, "y2": 1, "type": "linear", "global": false, "colorStops": [{ "offset": 0, "color": "rgba(80,141,255,0.39)" }, { "offset": 0.34, "color": "rgba(56,155,255,0.25)" }, { "offset": 1, "color": "rgba(38,197,254,0.00)" } ] } } } }]
V10版本的自助仪表盘中,具体请参考如下扩展属性
{ "series": [ { "areaStyle": { "normal": { "color": { "x": 0, "y": 0, "x2": 0, "y2": 1, "type": "linear", "global": false, "colorStops": [ { "offset": 0, "color": "rgba(80,141,255,0.39)" }, { "offset": 0.34, "color": "rgba(56,155,255,0.25)" }, { "offset": 1, "color": "rgba(38,197,254,0.00)" } ] } } } } ] }
另,如希望实现从横向颜色渐变,需要修改下图红框代码。
具体说明见百度文档:https://www.jianshu.com/p/238fbd7927ab