using System.Collections; using System.Collections.Generic; using UnityEngine; using XCharts.Runtime; public class Manager { public class TongSuanData { public float zhiji; public float serverct; public float devct; } public class JianKongPtData { public float shijianct; public float zhixingct; public float gaojingct; } public class ServerData { public List serverList = new List(); } public class ServerRoomData { public int id; public string name; public float wendu; public float shidu; public float zonggonglv; public float shangridl; public List videolist; public List jilonglist; } public class ServerVideoData { public int id; public int type; public string name; public string time; public List url; } public class ServerJiLongData { public int id; public string name; public List jiguilist; } public class ServerjiguiData { public int id; public string name; public float zgl; public float srz; public float szz; public float syz; public float wendu; public float shidu; } public class PieChartData { public List items; public float value; public string title; } public class PieChartItemData { public string name; public float value; } public class RingValueData { public string value; public string max; } public class GaoJingListData { public List list; } public class GaoJingItemData { public string lv; public string time; public string dev; public string type; } public class LineChartData { public List xdata; public List ydata; public List sdata; } public class LineChartSeriesData { public string name; public List values; } public static void setLineData(LineChart lineChart, LineChartData data) { setXValue(lineChart,data); setYValue(lineChart,data); setAllValue(lineChart,data); } static void setXValue(LineChart lineChart, LineChartData data) { XAxis x = lineChart.GetChartComponent(); x.data = data.xdata; } static void setYValue(LineChart lineChart, LineChartData data) { YAxis y = lineChart.GetChartComponent(); y.data = data.ydata; } static void setAllValue(LineChart lineChart, LineChartData data) { for (int i = 0; i < data.sdata.Count; i++) { if (lineChart.series.Count > i) { lineChart.series[i].serieName = data.sdata[i].name; Debug.Log(data.sdata[i].values.Count); lineChart.series[i].ClearData(); for (int j = 0; j < data.sdata[i].values.Count; j++) { if (lineChart.series[i].data.Count<=j) { SerieData sd = new SerieData(); sd.data = new List(); sd.data.Add(j); sd.data.Add(data.sdata[i].values[j]); lineChart.series[i].data.Add(sd); } else lineChart.series[i].data[j].data[1] = data.sdata[i].values[j]; } } } } }