echarts折线图阴影设置
需求:折线图变成曲线,且下方带有阴影渐变效果
![](https://upload-images.jianshu.io/upload_images/18344853-7f3e9a1b3440d977.png?imageMogr2/auto-orient/strip|imageView2/2/w/564/format/webp)
image.png
步骤:在series中修改smooth参数添加areaStyle样式,如下:
![](https://upload-images.jianshu.io/upload_images/18344853-fd04b5f5e497dd67.png?imageMogr2/auto-orient/strip|imageView2/2/w/1122/format/webp)
image.png
代码:
smooth: true,
areaStyle: {
normal: {
color: {
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [{
offset: 0,
color: "#dc3881" // 0% 处的颜色
}, {
offset: 0.7,
color: "rgba(220,56,129,0)" // 100% 处的颜色
}],
globalCoord: false // 缺省为 false
}
}
},