Commit 0429c98c authored by 陈龙's avatar 陈龙

fix: 修复接口未返回数据时组件报错的问题

parent db3c0629
...@@ -250,12 +250,18 @@ const SingleChart = memo((props) => { ...@@ -250,12 +250,18 @@ const SingleChart = memo((props) => {
_option.yAxis.min = 0; _option.yAxis.min = 0;
} }
} else { } else {
try {
_option.series.forEach(item => { _option.series.forEach(item => {
if (item.data.length === 0) { // 泳道图没有yAxisIndex
if (item.data.length === 0 && (item.yAxisIndex || item.yAxisIndex === 0)) {
_option.yAxis[item.yAxisIndex].max = 1; _option.yAxis[item.yAxisIndex].max = 1;
_option.yAxis[item.yAxisIndex].min = 0; _option.yAxis[item.yAxisIndex].min = 0;
item.data = [[moment(dataSource?.[0]?.dateFrom).valueOf(), null], [moment(dataSource?.[0]?.dateTo).valueOf(), null]]
} }
}) })
} catch (e) {
console.log(e)
}
} }
// 加入bi模式 // 加入bi模式
if (theme === 'BI') _option = patchBIOption(_option, BI); if (theme === 'BI') _option = patchBIOption(_option, BI);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment