lxh 1 deň pred
rodič
commit
278e94bb83
1 zmenil súbory, kde vykonal 74 pridanie a 78 odobranie
  1. 74 78
      src/components/chart/BarAndLine.vue

+ 74 - 78
src/components/chart/BarAndLine.vue

@@ -137,88 +137,84 @@ export default defineComponent({
           const minDigitCount = min.toFixed(0).length;
           let yMax = 0,
             yMin = 0;
-          if (option.series[index].name.indexOf('°C') == -1 && option.series[index].name.indexOf('%') == -1 ) {
-            if (digitCount < 2) {
-              if (max < 0.5) {
-                yMax = 1;
-              } else if (max < 0.9) {
-                yMax = 1.5;
-              } else if (max < 5) {
-                yMax = 5;
-              } else if (max < 10) {
-                yMax = 10;
-              }
-            } else if (digitCount < 3) {
-              const n = Number((Number(max.toFixed(0)) / 10).toFixed(0));
-              if (max < n * 10 + 5) {
-                yMax = (n + 1) * 10;
-              } else {
-                yMax = (n + 2) * 10;
-              }
-            } else if (digitCount < 4) {
-              const n = Number((Number(max.toFixed(0)) / 100).toFixed(0));
-              if (max < n * 100 + 50) {
-                yMax = (n + 1) * 100;
-              } else {
-                yMax = (n + 2) * 100;
-              }
-            } else if (digitCount < 5) {
-              const n = Number((Number(max.toFixed(0)) / 1000).toFixed(0));
-              if (max < n * 1000 + 500) {
-                yMax = (n + 1) * 1000;
-              } else {
-                yMax = (n + 1) * 1000 + 500;
-              }
-            } else if (digitCount < 6) {
-              const n = Number((Number(max.toFixed(0)) / 10000).toFixed(0));
-              if (max < n * 10000 + 5000) {
-                yMax = (n + 1) * 10000;
-              } else {
-                yMax = (n + 1) * 10000 + 5000;
-              }
+          if (digitCount < 2) {
+            if (max < 0.5) {
+              yMax = 1;
+            } else if (max < 0.9) {
+              yMax = 1.5;
+            } else if (max < 5) {
+              yMax = 5;
+            } else if (max < 10) {
+              yMax = 10;
             }
+          } else if (digitCount < 3) {
+            const n = Number((Number(max.toFixed(0)) / 10).toFixed(0));
+            if (max < n * 10 + 5) {
+              yMax = (n + 1) * 10;
+            } else {
+              yMax = (n + 2) * 10;
+            }
+          } else if (digitCount < 4) {
+            const n = Number((Number(max.toFixed(0)) / 100).toFixed(0));
+            if (max < n * 100 + 50) {
+              yMax = (n + 1) * 100;
+            } else {
+              yMax = (n + 2) * 100;
+            }
+          } else if (digitCount < 5) {
+            const n = Number((Number(max.toFixed(0)) / 1000).toFixed(0));
+            if (max < n * 1000 + 500) {
+              yMax = (n + 1) * 1000;
+            } else {
+              yMax = (n + 1) * 1000 + 500;
+            }
+          } else if (digitCount < 6) {
+            const n = Number((Number(max.toFixed(0)) / 10000).toFixed(0));
+            if (max < n * 10000 + 5000) {
+              yMax = (n + 1) * 10000;
+            } else {
+              yMax = (n + 1) * 10000 + 5000;
+            }
+          }
 
-            if (minDigitCount < 2) {
-              if (min > 1.5) {
-                yMin = 1.0;
-              } else if (min > 5) {
-                yMin = 5;
-              } else {
-                yMin = 0;
-              }
-            } else if (minDigitCount < 3) {
-              const n = Number((Number(min.toFixed(0)) / 10).toFixed(0));
-              if (n > 1) {
-                yMin = (n - 1) * 10;
-              } else {
-                yMin = 10;
-              }
-            } else if (digitCount < 4) {
-              const n = Number((Number(min.toFixed(0)) / 100).toFixed(0));
-              if (n > 1) {
-                yMin = (n - 1) * 100;
-              } else {
-                yMin = 100;
-              }
-            } else if (digitCount < 5) {
-              const n = Number((Number(min.toFixed(0)) / 1000).toFixed(0));
-              if (n > 1) {
-                yMin = (n - 1) * 1000;
-              } else {
-                yMin = 1000;
-              }
-            } else if (digitCount < 6) {
-              const n = Number((Number(min.toFixed(0)) / 10000).toFixed(0));
-              if (n > 1) {
-                yMin = (n - 1) * 10000;
-              } else {
-                yMin = 10000;
-              }
+          if (minDigitCount < 2) {
+            if (min > 1.5) {
+              yMin = 1.0;
+            } else if (min > 5) {
+              yMin = 5;
+            } else {
+              yMin = 0;
+            }
+          } else if (minDigitCount < 3) {
+            const n = Number((Number(min.toFixed(0)) / 10).toFixed(0));
+            if (n > 1) {
+              yMin = (n - 1) * 10;
+            } else {
+              yMin = 10;
+            }
+          } else if (digitCount < 4) {
+            const n = Number((Number(min.toFixed(0)) / 100).toFixed(0));
+            if (n > 1) {
+              yMin = (n - 1) * 100;
+            } else {
+              yMin = 100;
+            }
+          } else if (digitCount < 5) {
+            const n = Number((Number(min.toFixed(0)) / 1000).toFixed(0));
+            if (n > 1) {
+              yMin = (n - 1) * 1000;
+            } else {
+              yMin = 1000;
+            }
+          } else if (digitCount < 6) {
+            const n = Number((Number(min.toFixed(0)) / 10000).toFixed(0));
+            if (n > 1) {
+              yMin = (n - 1) * 10000;
+            } else {
+              yMin = 10000;
             }
-          } else {
-            yMax=100
-            yMin=0
           }
+
           propType.ymax = yMax;
           propType.ymin = yMin;
           return true;