Browse Source

update 0911 v2

andy 4 months ago
parent
commit
a1b3e839f4
2 changed files with 7 additions and 5 deletions
  1. 1 1
      index.html
  2. 6 4
      js/demo/text-to-chart.js

+ 1 - 1
index.html

@@ -494,7 +494,7 @@
             <div id="unit_input">
                 <p class="font-weight-bold">單位:</p>
                 <input type="text" id="unit_data" class="form-control bg-light small mb-3" aria-label="Search2"
-                    aria-describedby="basic-addon2">
+                    aria-describedby="basic-addon2" placeholder="請小於七個字">
             </div>
 
             <div class="d-flex mb-1">

+ 6 - 4
js/demo/text-to-chart.js

@@ -372,6 +372,7 @@ sendButton.addEventListener("click", function () {
 
     sendButtonClickHandler();
     inputField.value = ''
+    unit_value_box.style.display = "none"
     chartTypeBtn.style.display = "none";
 });
 
@@ -942,11 +943,12 @@ function generateBarChart(key, dataArray) {
     // label 換行
     let label = categoryAxis.renderer.labels.template;
     label.wrap = true;
-    if (dataArray.length > 5) {
+    if (dataArray.length > 8) {
         console.log('資料長度5')
-        label.maxWidth = 60;
-    } else if (dataArray.length < 7) {
-        label.maxWidth = 70;
+        label.maxWidth = 50;
+    }
+    else if (dataArray.length < 7) {
+        label.maxWidth = 80;
     } else {
         label.maxWidth = 100;
         console.log('資料長度<5')