提交 fe774a40 authored 作者: pengxiaohui's avatar pengxiaohui

fix: 修复图表数据不全时展示错位的bug [2219]

上级 0a462e5c
...@@ -94,7 +94,16 @@ export default { ...@@ -94,7 +94,16 @@ export default {
} }
getChart(params).then(res => { getChart(params).then(res => {
if (res.code === 0 && res.data && Array.isArray(res.data.chart)) { if (res.code === 0 && res.data && Array.isArray(res.data.chart)) {
this.options.series[0].data = res.data.chart.map(item => parseFloat(item.percent)) const list = JSON.parse(JSON.stringify(this.value.options))
list.forEach(item => {
const select = res.data.chart.find(it => it.option === parseFloat(item.tag))
if (select) {
item.value = parseFloat(select.percent)
} else {
item.value = 0
}
})
this.options.series[0].data = list.map(item => parseFloat(item.value))
this.echart.setOption(this.options) this.echart.setOption(this.options)
} }
}) })
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论