4.5.0
在echarts配置项手册上看到lineStyle里面的shadowColor支持的格式跟color一致,那么就意味着是可以支持渐变色的。但是我这边使用下面的配置之后发现,线的颜色渐变了,但是阴影没有展示,把shadowColor的颜色换成rgba格式之后,阴影就可以正常显示了。
option = {
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [{
data: [820, 932, 901, 934, 1290, 1330, 1320],
type: 'line',
smooth: true,
lineStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [{
offset: 0, color: 'red' // 0% 处的颜色
}, {
offset: 1, color: 'blue' // 100% 处的颜色
}],
global: false // 缺省为 false
},
shadowColor: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [{
offset: 0, color: 'red' // 0% 处的颜色
}, {
offset: 1, color: 'blue' // 100% 处的颜色
}],
global: false // 缺省为 false
},
shadowBlur: 10,
shadowOffsetY: 12
}
}]
};
阴影正常出现,并且颜色是渐变的。
阴影没有出现
Hi! We've received your issue and please be patient to get responded. 🎉
The average response time is expected to be within one day for weekdays.
In the meanwhile, please make sure that you have posted enough image to demo your request. You may also check out the API and chart option to get the answer.
If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to [email protected]. Please attach the issue link if it's a technical questions.
If you are interested in the project, you may also subscribe our mail list.
Have a nice day! 🍵
shadowColor 应该不支持渐变,文档可能需要更新下。因为底层 canvas 如果直接采用ctx.shadowColor 去配置,是不支持 LieanerGradient 对象的。
Most helpful comment
shadowColor 应该不支持渐变,文档可能需要更新下。因为底层 canvas 如果直接采用ctx.shadowColor 去配置,是不支持 LieanerGradient 对象的。