echarts折线图阴影设置

33 阅读1分钟

需求:折线图变成曲线,且下方带有阴影渐变效果

  • 步骤:在series中修改smooth参数添加areaStyle样式,如下:

代码:

series: [
{
data: [820932901934129013301320],
type"line",
smoothtrue,
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
},
},
},
},
],