fix: 修复overview第三行第一个图无数据时的bug
This commit is contained in:
@@ -96,13 +96,13 @@
|
|||||||
if(!this.option){
|
if(!this.option){
|
||||||
this.option = chartConfig.getOption(this.chartType);
|
this.option = chartConfig.getOption(this.chartType);
|
||||||
}
|
}
|
||||||
if (legend && legendData) {
|
if (legend && legendData && legendData.length > 0) {
|
||||||
legend.formatter = function(name) {
|
legend.formatter = function(name) {
|
||||||
let type = legendData.find(item => {
|
let type = legendData.find(item => {
|
||||||
return item[0] == name;
|
return item[0] == name;
|
||||||
});
|
});
|
||||||
return `${name} (${type[1]}%)`;
|
return type ? `${name} (${type[1]}%)` : null;
|
||||||
}
|
};
|
||||||
this.$set(this.option, "legend", legend);
|
this.$set(this.option, "legend", legend);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -359,13 +359,13 @@
|
|||||||
let vm = this;
|
let vm = this;
|
||||||
let assetTotalCount = function() {
|
let assetTotalCount = function() {
|
||||||
let count = 0;
|
let count = 0;
|
||||||
vm.assetData.typeStat.forEach(item => {
|
vm.assetData.typeStat && vm.assetData.typeStat.forEach(item => {
|
||||||
count += item.total;
|
count += item.total;
|
||||||
});
|
});
|
||||||
return count;
|
return count;
|
||||||
}();
|
}();
|
||||||
|
|
||||||
this.assetData.typeStat.forEach(item => {
|
vm.assetData.typeStat && this.assetData.typeStat.forEach(item => {
|
||||||
legendData.push([item.name, (item.total*100/assetTotalCount).toFixed(2)]);
|
legendData.push([item.name, (item.total*100/assetTotalCount).toFixed(2)]);
|
||||||
typeSeriesData.push({name: item.name, value: item.total, up: item.pingUp, down: item.pingDown});
|
typeSeriesData.push({name: item.name, value: item.total, up: item.pingUp, down: item.pingDown});
|
||||||
});
|
});
|
||||||
@@ -430,7 +430,7 @@
|
|||||||
right: 25,
|
right: 25,
|
||||||
icon: "circle",
|
icon: "circle",
|
||||||
};
|
};
|
||||||
this.$refs.assetTypePie.setSeries(series, legend, legendData);
|
this.assetData.typeStat && this.$refs.assetTypePie.setSeries(series, legend, legendData);
|
||||||
this.$refs.assetTypePie.endLoading();
|
this.$refs.assetTypePie.endLoading();
|
||||||
}
|
}
|
||||||
resolve()
|
resolve()
|
||||||
|
|||||||
Reference in New Issue
Block a user