Manager.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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 string name;
  38. public string time;
  39. public List<string> url;
  40. }
  41. public class ServerJiLongData
  42. {
  43. public int id;
  44. public string name;
  45. public List<ServerjiguiData> jiguilist;
  46. }
  47. public class ServerjiguiData
  48. {
  49. public int id;
  50. public string name;
  51. public float zgl;
  52. public float srz;
  53. public float szz;
  54. public float syz;
  55. public float wendu;
  56. public float shidu;
  57. }
  58. public class PieChartData
  59. {
  60. public List<PieChartItemData> items;
  61. public float value;
  62. public string title;
  63. }
  64. public class PieChartItemData
  65. {
  66. public string name;
  67. public float value;
  68. }
  69. public class RingValueData
  70. {
  71. public string value;
  72. public string max;
  73. }
  74. public class GaoJingListData
  75. {
  76. public List<GaoJingItemData> list;
  77. }
  78. public class GaoJingItemData
  79. {
  80. public string lv;
  81. public string time;
  82. public string dev;
  83. public string type;
  84. }
  85. public class LineChartData
  86. {
  87. public List<string> xdata;
  88. public List<string> ydata;
  89. public List<LineChartSeriesData> sdata;
  90. }
  91. public class LineChartSeriesData
  92. {
  93. public string name;
  94. public List<float> values;
  95. }
  96. public static void setLineData(LineChart lineChart, LineChartData data)
  97. {
  98. setXValue(lineChart,data);
  99. setYValue(lineChart,data);
  100. setAllValue(lineChart,data);
  101. }
  102. static void setXValue(LineChart lineChart, LineChartData data)
  103. {
  104. XAxis x = lineChart.GetChartComponent<XAxis>();
  105. x.data = data.xdata;
  106. }
  107. static void setYValue(LineChart lineChart, LineChartData data)
  108. {
  109. YAxis y = lineChart.GetChartComponent<YAxis>();
  110. y.data = data.ydata;
  111. }
  112. static void setAllValue(LineChart lineChart, LineChartData data)
  113. {
  114. for (int i = 0; i < data.sdata.Count; i++)
  115. {
  116. if (lineChart.series.Count > i)
  117. {
  118. lineChart.series[i].serieName = data.sdata[i].name;
  119. Debug.Log(data.sdata[i].values.Count);
  120. for (int j = 0; j < data.sdata[i].values.Count; j++)
  121. {
  122. if (lineChart.series[i].data.Count<=j)
  123. {
  124. SerieData sd = new SerieData();
  125. sd.data = new List<double>();
  126. sd.data.Add(j);
  127. sd.data.Add(data.sdata[i].values[j]);
  128. lineChart.series[i].data.Add(sd);
  129. }
  130. else
  131. lineChart.series[i].data[j].data[1] = data.sdata[i].values[j];
  132. }
  133. }
  134. }
  135. }
  136. }