|
|
@@ -237,10 +237,22 @@
|
|
|
newData.forEach((item) => {
|
|
|
yData.push(item.quantity);
|
|
|
});
|
|
|
+ let value = newData.reduce((a, b) => a + b.quantity, 0);
|
|
|
this.maintainChart.setOption({
|
|
|
series: [
|
|
|
{ type: "custom", name: "时效", data: yData },
|
|
|
- { type: "bar", name: "比例", data: yData },
|
|
|
+ { type: "bar", name: "比例", data: yData,
|
|
|
+ label: {
|
|
|
+ normal: {
|
|
|
+ formatter: (e) => {
|
|
|
+ if(value == 0){
|
|
|
+ value = 1;
|
|
|
+ }
|
|
|
+ return e.value / value * 100 + '%';
|
|
|
+ },
|
|
|
+ }
|
|
|
+ }},
|
|
|
+
|
|
|
],
|
|
|
});
|
|
|
},
|