fix: 修复overview第三行第一个图无数据时的bug

This commit is contained in:
chenjinsong
2020-10-19 12:07:22 +08:00
parent ac9f058579
commit eb7e64eb89
2 changed files with 6 additions and 6 deletions

View File

@@ -96,13 +96,13 @@
if(!this.option){
this.option = chartConfig.getOption(this.chartType);
}
if (legend && legendData) {
if (legend && legendData && legendData.length > 0) {
legend.formatter = function(name) {
let type = legendData.find(item => {
return item[0] == name;
});
return `${name} (${type[1]}%)`;
}
return type ? `${name} (${type[1]}%)` : null;
};
this.$set(this.option, "legend", legend);
}