需求:折线图变成曲线,且下方带有阴影渐变效果
-
步骤:在series中修改smooth参数添加areaStyle样式,如下:
代码:
series: [
{
data: [820, 932, 901, 934, 1290, 1330, 1320],
type: "line",
smooth: true,
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
},
},
},
},
],