echarts
echarts copied to clipboard
关于设置渐变色的报错
One-line summary [问题简述]
当我给图表设置渐变色的时候,如果没有数据的话,就会报错

Version & Environment [版本及环境]
- ECharts version [ECharts 版本]: 4.0
- Browser version [浏览器类型和版本]: Chrome 64
- OS Version [操作系统类型和版本]: win10
Expected behaviour [期望结果]
希望可以规避这个报错,抛出这个错误,如果用Vue中的计算属性来控制setOption时,图表后续不会根据options变化更新
ECharts option [ECharts配置项]
option = {
dataset: {
dimensions: ['x', 'y', 'z'],
source: [
{x: 'Mon', y: 820},
{x: 'Tue', y: 932},
{x: 'Wed', y: 901}
]
},
xAxis: {
type: 'category',
boundaryGap: false
},
yAxis: {
type: 'value'
},
series: [{
type: 'line',
areaStyle: {
normal: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [{
offset: 0, color: 'rgb(68, 183, 245)'
}, {
offset: 1, color: 'rgb(255, 70, 131)'
}]
}
}
}
},
{
type: 'line',
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: 'rgb(255, 158, 68)' },
{ offset: 1, color: 'rgb(255, 70, 131)' }
])
}
}
}
]
};
Other comments [其他信息]
👍
@cn-xufei 已修复,下个版本上线~
@Ovilia 多谢,下个版本计划何时发布?
@cn-xufei 平均发版时间是一个月左右,根据具体情况会调整
急用的话,可以自己编译一份
好的🤝