Commit 2642ea8f5c447160468edccbf315b522a2d0d21a
1 parent
19b317dd
fix: DEFECT-1294 修复PC管理端首页设备状态统计,显示NAN问题
Showing
1 changed file
with
2 additions
and
6 deletions
@@ -83,12 +83,11 @@ | @@ -83,12 +83,11 @@ | ||
83 | chartsInstance[key!] = echarts.init( | 83 | chartsInstance[key!] = echarts.init( |
84 | document.getElementById(`chartPie${key}`) as HTMLElement | 84 | document.getElementById(`chartPie${key}`) as HTMLElement |
85 | ); | 85 | ); |
86 | - console.log('11', skinName.value); | ||
87 | const option = { | 86 | const option = { |
88 | backgroundColor: skinName.value, | 87 | backgroundColor: skinName.value, |
89 | tooltip: { | 88 | tooltip: { |
90 | trigger: 'item', | 89 | trigger: 'item', |
91 | - formatter: `${legendKey}设备${((value! / total!) * 100).toFixed(2)}%`, | 90 | + formatter: `${legendKey}设备${((!value ? 0 : value! / total!) * 100).toFixed(2)}%`, |
92 | }, | 91 | }, |
93 | graphic: [ | 92 | graphic: [ |
94 | { | 93 | { |
@@ -113,7 +112,7 @@ | @@ -113,7 +112,7 @@ | ||
113 | normal: { | 112 | normal: { |
114 | show: true, | 113 | show: true, |
115 | position: 'outer', | 114 | position: 'outer', |
116 | - formatter: `${legendKey}${((value! / total!) * 100).toFixed(2)}%`, | 115 | + formatter: `${legendKey}${((!value ? 0 : value! / total!) * 100).toFixed(2)}%`, |
117 | borderWidth: 5, | 116 | borderWidth: 5, |
118 | borderRadius: 0, | 117 | borderRadius: 0, |
119 | padding: [90, -30], | 118 | padding: [90, -30], |
@@ -124,9 +123,6 @@ | @@ -124,9 +123,6 @@ | ||
124 | ], | 123 | ], |
125 | }; | 124 | }; |
126 | chartsInstance[key!].setOption(option); | 125 | chartsInstance[key!].setOption(option); |
127 | - // chartsInstance[key!].setOption({ | ||
128 | - // backgroundColor: skinName, | ||
129 | - // }); | ||
130 | } | 126 | } |
131 | }); | 127 | }); |
132 | 128 |