Explorar el Código

每次打开水位、降雨面板清空数据

Void_F hace 5 días
padre
commit
b66c0a8207

+ 9 - 9
Assets/Prefabs/UI/WaterTrendPanel.prefab

@@ -7988,7 +7988,7 @@ RectTransform:
   m_GameObject: {fileID: 1884876626226038780}
   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
-  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_LocalScale: {x: 0, y: 0, z: 0}
   m_ConstrainProportionsScale: 0
   m_Children:
   - {fileID: 2657697681184236664}
@@ -14774,7 +14774,7 @@ RectTransform:
   m_GameObject: {fileID: 2034501008142644078}
   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
-  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_LocalScale: {x: 0, y: 0, z: 0}
   m_ConstrainProportionsScale: 0
   m_Children:
   - {fileID: 2034501007576326614}
@@ -15556,7 +15556,7 @@ RectTransform:
   m_GameObject: {fileID: 2034501008273103086}
   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
-  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_LocalScale: {x: 0, y: 0, z: 0}
   m_ConstrainProportionsScale: 0
   m_Children:
   - {fileID: 2034501009243304164}
@@ -16728,7 +16728,7 @@ RectTransform:
   m_GameObject: {fileID: 2034501008475670655}
   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
-  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_LocalScale: {x: 0, y: 0, z: 0}
   m_ConstrainProportionsScale: 0
   m_Children:
   - {fileID: 2034501007153561317}
@@ -18596,7 +18596,7 @@ RectTransform:
   m_GameObject: {fileID: 2034501008914180638}
   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
-  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_LocalScale: {x: 0, y: 0, z: 0}
   m_ConstrainProportionsScale: 0
   m_Children:
   - {fileID: 2034501008621006390}
@@ -32117,7 +32117,7 @@ RectTransform:
   m_GameObject: {fileID: 4544996608059761212}
   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
-  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_LocalScale: {x: 0, y: 0, z: 0}
   m_ConstrainProportionsScale: 0
   m_Children:
   - {fileID: 1913709242357377468}
@@ -44794,7 +44794,7 @@ RectTransform:
   m_GameObject: {fileID: 7043820139416451179}
   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
-  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_LocalScale: {x: 0, y: 0, z: 0}
   m_ConstrainProportionsScale: 0
   m_Children:
   - {fileID: 8670710784005932134}
@@ -45256,7 +45256,7 @@ RectTransform:
   m_GameObject: {fileID: 7204469873957513120}
   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
-  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_LocalScale: {x: 0, y: 0, z: 0}
   m_ConstrainProportionsScale: 0
   m_Children:
   - {fileID: 7491185687818382323}
@@ -49435,7 +49435,7 @@ RectTransform:
   m_GameObject: {fileID: 8003399528438951295}
   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
-  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_LocalScale: {x: 0, y: 0, z: 0}
   m_ConstrainProportionsScale: 0
   m_Children:
   - {fileID: 3202674770744282122}

+ 11 - 9
Assets/Scripts/UI/UIView/YZT/WaterTrendPanel.cs

@@ -199,6 +199,17 @@ public class WaterTrendPanel : MonoBehaviour
 
     public async Task ShowTrend(string stcd, string name,int type)
     {
+        var tempSeries = _LineChart.series;
+        tempSeries[0].data.Clear();
+        if (listObj.Count > 0)
+        {
+            GameObject[] deleteObjs = listObj.ToArray();
+            for (int i = 0; i < deleteObjs.Length; i++)
+            {
+                Destroy(deleteObjs[i]);
+            }
+        }
+        listObj.Clear();
         
         string endTime = DateTime.Now.ToString("yyyy-MM-dd");
         string startTime = DateTime.Now.AddMonths(-3).ToString("yyyy-MM-dd");
@@ -334,16 +345,7 @@ public class WaterTrendPanel : MonoBehaviour
         var wait = new WaitForEndOfFrame();
         WaterTrendData_Chart tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<WaterTrendData_Chart>(jsonData);
 
-        if (listObj.Count > 0)
-        {
-            GameObject[] deleteObjs = listObj.ToArray();
-            for (int i = 0; i < deleteObjs.Length; i++)
-            {
-                Destroy(deleteObjs[i]);
-            }
-        }
 
-        listObj.Clear();
         int creatCount = 0;
         for (int i = 0; i < tempData.data.Count; i++)
         {