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 | 83 | chartsInstance[key!] = echarts.init( |
| 84 | 84 | document.getElementById(`chartPie${key}`) as HTMLElement |
| 85 | 85 | ); |
| 86 | - console.log('11', skinName.value); | |
| 87 | 86 | const option = { |
| 88 | 87 | backgroundColor: skinName.value, |
| 89 | 88 | tooltip: { |
| 90 | 89 | trigger: 'item', |
| 91 | - formatter: `${legendKey}设备${((value! / total!) * 100).toFixed(2)}%`, | |
| 90 | + formatter: `${legendKey}设备${((!value ? 0 : value! / total!) * 100).toFixed(2)}%`, | |
| 92 | 91 | }, |
| 93 | 92 | graphic: [ |
| 94 | 93 | { |
| ... | ... | @@ -113,7 +112,7 @@ |
| 113 | 112 | normal: { |
| 114 | 113 | show: true, |
| 115 | 114 | position: 'outer', |
| 116 | - formatter: `${legendKey}${((value! / total!) * 100).toFixed(2)}%`, | |
| 115 | + formatter: `${legendKey}${((!value ? 0 : value! / total!) * 100).toFixed(2)}%`, | |
| 117 | 116 | borderWidth: 5, |
| 118 | 117 | borderRadius: 0, |
| 119 | 118 | padding: [90, -30], |
| ... | ... | @@ -124,9 +123,6 @@ |
| 124 | 123 | ], |
| 125 | 124 | }; |
| 126 | 125 | chartsInstance[key!].setOption(option); |
| 127 | - // chartsInstance[key!].setOption({ | |
| 128 | - // backgroundColor: skinName, | |
| 129 | - // }); | |
| 130 | 126 | } |
| 131 | 127 | }); |
| 132 | 128 | ... | ... |