|
@@ -143,6 +143,9 @@ public class SWYJLayer : YZTRootLayer
|
|
|
|
|
|
public GameObject byThreeLine;
|
|
|
public GameObject tkThreesLine;
|
|
|
+
|
|
|
+ public Text[] xAxisLabels;
|
|
|
+
|
|
|
private void Awake()
|
|
|
{
|
|
|
Init();
|
|
@@ -455,6 +458,13 @@ public class SWYJLayer : YZTRootLayer
|
|
|
miniMap.gameObject.SetActive(false);
|
|
|
main.gameObject.SetActive(true);
|
|
|
});
|
|
|
+
|
|
|
+
|
|
|
+ xAxisLabels = new Text[6];
|
|
|
+ for (int i = 0; i < xAxisLabels.Length; i++)
|
|
|
+ {
|
|
|
+ xAxisLabels[i] = this.transform.Find("RightUp/ShuiWeiTongJi/XAxisLabels").GetChild(i).GetComponent<Text>();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -643,6 +653,37 @@ public class SWYJLayer : YZTRootLayer
|
|
|
}
|
|
|
tempXaxis.axisName.name = yearsRange;
|
|
|
}
|
|
|
+
|
|
|
+ foreach (var item in xAxisLabels)
|
|
|
+ {
|
|
|
+ item.text = "";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (tempData.data.Count > 0)
|
|
|
+ {
|
|
|
+ if (tempData.data[0].time.Equals(tempData.data[^1].time))
|
|
|
+ {
|
|
|
+ xAxisLabels[3].text = DateTime.Parse(tempData.data[0].time) .ToString("MM-dd");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var startDateTime = DateTime.Parse(tempData.data[0].time);
|
|
|
+ var endDateTime = DateTime.Parse(tempData.data[^1].time);
|
|
|
+ xAxisLabels[0].text =startDateTime .ToString("MM-dd");
|
|
|
+ xAxisLabels[5].text =endDateTime.ToString("MM-dd");
|
|
|
+
|
|
|
+ double totalDays = (endDateTime - startDateTime).TotalDays;
|
|
|
+
|
|
|
+ if (totalDays> 6)
|
|
|
+ {
|
|
|
+ for (int i = 1; i < 5; i++)
|
|
|
+ {
|
|
|
+ xAxisLabels[i].text= startDateTime.AddDays(((int)(totalDays / 4)) * i).ToString("MM-dd");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
var tempSeries = shuiWeiBianHua.series;
|
|
|
tempSeries[1].serieName = "水位(m)";
|
|
@@ -666,6 +707,24 @@ public class SWYJLayer : YZTRootLayer
|
|
|
tempSeries[1].data.Clear();
|
|
|
tempSeries[1].data.AddRange(tempDatas);
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (timeType == 0)
|
|
|
+ {
|
|
|
+ for (int i = 0; i < xAxisLabels.Length; i++)
|
|
|
+ {
|
|
|
+ xAxisLabels[i].text= today.AddDays(-20+i).ToString("MM-dd");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ for (int i = 0; i < xAxisLabels.Length; i++)
|
|
|
+ {
|
|
|
+ xAxisLabels[i].text= today.AddDays(-6+i).ToString("MM-dd");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|