浏览代码

fix: :bug: 图表零值不隐藏

chaooo 2 年之前
父节点
当前提交
90021f0792
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/components/Charts/RadarChart.vue

+ 2 - 2
src/components/Charts/RadarChart.vue

@@ -110,7 +110,7 @@ const indicatorFormatter = (name: string, indicator: any) => {
  * 在图中定位每个数据的位置
  */
 const positionLabelData = (data: number[], idx: number) => {
-  const labelValue: any = [0, 0, 0, 0, 0];
+  const labelValue: any = [-1, -1, -1, -1, -1];
   labelValue[idx] = data[idx];
   // idx = 0,1,2,3,4 对应 top,left,bottom,bottom,right
   let pos = "bottom";
@@ -130,7 +130,7 @@ const positionLabelData = (data: number[], idx: number) => {
       fontSize: 12,
       position: pos,
       formatter: (params: any) => {
-        return params.value > 0 ? params.value : "";
+        return params.value >= 0 ? params.value : "";
       },
     },
   };