Manager.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using XCharts.Runtime;
  5. public class Manager
  6. {
  7. public class TongSuanData
  8. {
  9. public float zhiji;
  10. public float serverct;
  11. public float devct;
  12. }
  13. public class JianKongPtData
  14. {
  15. public float shijianct;
  16. public float zhixingct;
  17. public float gaojingct;
  18. }
  19. public class ServerData
  20. {
  21. public List<ServerRoomData> serverList = new List<ServerRoomData>();
  22. }
  23. public class ServerRoomData
  24. {
  25. public int id;
  26. public string name;
  27. public float wendu;
  28. public float shidu;
  29. public float zonggonglv;
  30. public float shangridl;
  31. public List<ServerVideoData> videolist;
  32. public List<ServerJiLongData> jilonglist;
  33. }
  34. public class ServerVideoData
  35. {
  36. public int id;
  37. public int type;
  38. public string name;
  39. public string time;
  40. public List<string> url;
  41. }
  42. public class ServerJiLongData
  43. {
  44. public int id;
  45. public string name;
  46. public List<ServerjiguiData> jiguilist;
  47. }
  48. public class ServerjiguiData
  49. {
  50. public int id;
  51. public string name;
  52. public float zgl;
  53. public float srz;
  54. public float szz;
  55. public float syz;
  56. public float wendu;
  57. public float shidu;
  58. }
  59. public class PieChartData
  60. {
  61. public List<PieChartItemData> items;
  62. public float value;
  63. public string title;
  64. }
  65. public class PieChartItemData
  66. {
  67. public string name;
  68. public float value;
  69. }
  70. public class RingValueData
  71. {
  72. public string value;
  73. public string max;
  74. }
  75. public class GaoJingListData
  76. {
  77. public List<GaoJingItemData> list;
  78. }
  79. public class GaoJingItemData
  80. {
  81. public string lv;
  82. public string time;
  83. public string dev;
  84. public string type;
  85. }
  86. public class LineChartData
  87. {
  88. public List<string> xdata;
  89. public List<string> ydata;
  90. public List<LineChartSeriesData> sdata;
  91. }
  92. public class LineChartSeriesData
  93. {
  94. public string name;
  95. public List<float> values;
  96. }
  97. public static void setLineData(LineChart lineChart, LineChartData data)
  98. {
  99. setXValue(lineChart,data);
  100. setYValue(lineChart,data);
  101. setAllValue(lineChart,data);
  102. }
  103. static void setXValue(LineChart lineChart, LineChartData data)
  104. {
  105. XAxis x = lineChart.GetChartComponent<XAxis>();
  106. x.data = data.xdata;
  107. }
  108. static void setYValue(LineChart lineChart, LineChartData data)
  109. {
  110. YAxis y = lineChart.GetChartComponent<YAxis>();
  111. y.data = data.ydata;
  112. }
  113. static void setAllValue(LineChart lineChart, LineChartData data)
  114. {
  115. for (int i = 0; i < data.sdata.Count; i++)
  116. {
  117. if (lineChart.series.Count > i)
  118. {
  119. lineChart.series[i].serieName = data.sdata[i].name;
  120. Debug.Log(data.sdata[i].values.Count);
  121. lineChart.series[i].ClearData();
  122. for (int j = 0; j < data.sdata[i].values.Count; j++)
  123. {
  124. if (lineChart.series[i].data.Count<=j)
  125. {
  126. SerieData sd = new SerieData();
  127. sd.data = new List<double>();
  128. sd.data.Add(j);
  129. sd.data.Add(data.sdata[i].values[j]);
  130. lineChart.series[i].data.Add(sd);
  131. }
  132. else
  133. lineChart.series[i].data[j].data[1] = data.sdata[i].values[j];
  134. }
  135. }
  136. }
  137. }
  138. }