void animateAddPointFromEnd(Vector2 pointVec, float animDuration) { if (series1.pointValues.Count == 0) // no end to animate from, just add the point { series1.pointValues.Add(pointVec); indicatorGO.SetActive(true); graph.Refresh(); // Ensures gamobject list of series points is up to date based on pointValues updateIndicator(); } else { series1.pointValues.Add(series1.pointValues[series1.pointValues.Count - 1]); if (pointVec.x > graph.xAxis.AxisMaxValue) // the new point will exceed the x-axis max { addPointAnimTimeline = 0; // animates from 0 to 1 Vector2 oldEnd = new Vector2(series1.pointValues[series1.pointValues.Count - 1].x, series1.pointValues[series1.pointValues.Count - 1].y); Vector2 newStart = new Vector2(series1.pointValues[1].x, series1.pointValues[1].y); Vector2 oldStart = new Vector2(series1.pointValues[0].x, series1.pointValues[0].y); WMG_Anim.animFloatCallbacks(() => addPointAnimTimeline, x => addPointAnimTimeline = x, animDuration, 1, () => onUpdateAnimateAddPoint(pointVec, oldEnd, newStart, oldStart), () => onCompleteAnimateAddPoint(), plotEaseType); } else { WMG_Anim.animVec2CallbackU(() => series1.pointValues[series1.pointValues.Count - 1], x => series1.pointValues[series1.pointValues.Count - 1] = x, animDuration, pointVec, () => updateIndicator(), plotEaseType); } } }
public void InitierGraf() { //initialisering. skjer også i 'void Oppdater()' waterMM = thisSpot.WaterMM; air = thisSpot.Air; smallLife = thisSpot.SmallLife; plantHeight = thisSpot.PHeight; humusQuality = thisSpot.HumusQuality; ; nitrogen = thisSpot.Nitrogen; organicMatter = thisSpot.OrganicMatter; //testData = containerValues.MinVektorListe;// dette er kanskje måten eksterne vektorer kan bli tilgjengelige //tilf1Data = containerValues.MinVektorListe3; soltimer = Weather.Sun;//vektorliste til graf waterData = Weather.Rain;//mm nedbør series1 = graph.addSeries(); //legger inn series1. den hentes vha graphGO.Getcomponent se linje 20 series2 = graph.addSeries(); // soltimer series3 = graph.addSeries(); // waterData series4 = graph.addSeries(); series5 = graph.addSeries(); series6 = graph.addSeries(); series7 = graph.addSeries(); series8 = graph.addSeries(); series9 = graph.addSeries(); graph.xAxis.AxisMaxValue = 28; series1.seriesName = "Water"; series2.seriesName = "Soltimer"; series3.seriesName = "Rain mm"; series4.seriesName = "Oxygen"; series5.seriesName = "plant height"; series6.seriesName = "smallLife"; series7.seriesName = "humusQuality"; series8.seriesName = "Nitrogen"; series9.seriesName = "organicMatter"; series1.lineColor = Color.grey; series2.lineColor = Color.yellow; series3.lineColor = Color.blue; series4.lineColor = Color.cyan; series5.lineColor = Color.green; //plant height series6.lineColor = Color.black; series7.lineColor = Color.grey; series8.lineColor = Color.red; series9.lineColor = Color.magenta; graph.Refresh(); }
void animateAddPointFromEnd(Vector2 pointVec, float animDuration) { if (series1.pointValues.Count == 0) { series1.pointValues.Add(pointVec); graph.Refresh(); // Ensures gamobject list of series points is up to date based on pointValues } else { // 애니메이션으로 그래프 증가후 데이터에 추가 series1.pointValues.Add(series1.pointValues[series1.pointValues.Count - 1]); // x값이 최대치에 닿았으면 if (pointVec.x > graph.xAxis.AxisMaxValue) { addPointAnimTimeline = 0; // animates from 0 to 1 Vector2 oldEnd = new Vector2(series1.pointValues[series1.pointValues.Count - 1].x, series1.pointValues[series1.pointValues.Count - 1].y); Vector2 newStart = new Vector2(series1.pointValues[1].x, series1.pointValues[1].y); Vector2 oldStart = new Vector2(series1.pointValues[0].x, series1.pointValues[0].y); WMG_Anim.animFloatCallbacks(() => addPointAnimTimeline, x => addPointAnimTimeline = x, animDuration, 1, () => onUpdateAnimateAddPoint(pointVec, oldEnd, newStart, oldStart), () => onCompleteAnimateAddPoint(), plotEaseType); } else { // 그냥 선그리기 애니 WMG_Anim.animVec2CallbackU(() => series1.pointValues[series1.pointValues.Count - 1], x => series1.pointValues[series1.pointValues.Count - 1] = x, animDuration, pointVec, () => updateIndicator(), plotEaseType); } } }
void Hello() { barGraph = transform.Find("BarGraphTest").GetComponent <WMG_Axis_Graph>(); barGraph.deleteSeries(); barGraph.deleteSeries(); //设置图形样式 barGraph.graphType = WMG_Axis_Graph.graphTypes.line; //x轴设置 barGraph.xAxis.hideGrid = true; barGraph.xAxis.LabelType = WMG_Axis.labelTypes.ticks; barGraph.xAxis.AxisLabelSize = 10; //x轴下标字体大小 barGraph.xAxis.AxisMaxValue = 24; //x轴总长度 barGraph.xAxis.AxisLabelColor = new Color32(250, 238, 36, 255); //标记颜色 //y轴设置 barGraph.yAxis.AxisLabelSize = 9; // barGraph.yAxis.AxisMaxValue = 300; //y轴最大值 barGraph.yAxis.AxisNumTicks = 11; //y轴标记个数 barGraph.yAxis.AxisLabelSpaceOffset = 2; //标字与轴的距离 barGraph.yAxis.AxisLabelColor = new Color32(250, 238, 36, 255); //标记颜色 //图表的设置 series1 = barGraph.addSeries(); series1.comboType = WMG_Series.comboTypes.line; series1.UseXDistBetweenToSpace = true; series1.seriesName = "发电功率"; barGraph.Refresh(); }
} //Start() public void Oppdater() { if (true) { Debug.Log("valg gjort. eventuelt oppdatering"); List <string> groups = new List <string>(); List <Vector2> data = new List <Vector2>(); for (int i = 0; i < series1Data2.Count; i++) { string[] row = series1Data2[i].Split(','); groups.Add(row[0]); if (!string.IsNullOrEmpty(row[1])) { float y = float.Parse(row[1]); data.Add(new Vector2(i + 1, y)); } } graph.groups.SetList(groups); graph.useGroups = true; graph.xAxis.LabelType = WMG_Axis.labelTypes.groups; graph.xAxis.AxisNumTicks = groups.Count; series1.seriesName = "Fruit Data"; series1.UseXDistBetweenToSpace = true; series1.pointValues.SetList(data); graph.Refresh(); } }
public void patientadded() { points.Add(new Vector2(timer, patients)); SERIES1.pointValues.SetList(points); graph.Refresh(); }
void Hello() { todayGeneEnergy = transform.Find("todayGeneEnergy").GetComponent <Text>(); nowPower = transform.Find("nowPower").GetComponent <Text>(); todayEqualHour = transform.Find("todayEqualHour").GetComponent <Text>(); todayGenePowerProfit = transform.Find("todayGenePowerProfit").GetComponent <Text>(); barGraph = GameObject.Find("BarGraphChe").GetComponent <WMG_Axis_Graph>(); //删除自带的两个series barGraph.deleteSeries(); barGraph.deleteSeries(); series1 = barGraph.addSeries(); //自己添加series //设置为柱形图 barGraph.graphType = WMG_Axis_Graph.graphTypes.bar_side; barGraph.Refresh(); //y轴设置 // barGraph.yAxis.AxisMaxValue = 100; barGraph.yAxis.AxisMinValue = 0; barGraph.yAxis.AxisNumTicks = 11; barGraph.yAxis.AxisLabelColor = new Color32(250, 238, 36, 255); //x轴设置 barGraph.xAxis.LabelType = WMG_Axis.labelTypes.ticks; barGraph.xAxis.AxisLabelColor = new Color32(250, 238, 36, 255); barGraph.xAxis.AxisNumTicks = 19; //4点到22点 series1.comboType = WMG_Series.comboTypes.bar; series1.dataLabelsEnabled = true; series1.dataLabelsNumDecimals = 0; series1.dataLabelsFontSize = 12; series1.dataLabelsColor = new Color32(250, 238, 36, 255); series1.dataLabelsOffset = new Vector2(0, 5); series1.UseXDistBetweenToSpace = true; series1.ManuallySetXDistBetween = true; series1.xDistBetweenPoints = 26f; series1.ManuallySetExtraXSpace = true; series1.seriesName = "光伏车棚"; series1.extraXSpace = 0; //自动更新数字到x轴中 series1.UseXDistBetweenToSpace = true; barGraph.Refresh(); }
// Use this for initialization void Start() { //her kommer tillegg zpots = Field.Spots; //waterMM = zpots[0, 0].WaterMM; //air = zpots[0, 0].Air; GameObject graphGO = GameObject.Instantiate(emptyGraphPrefab); graphGO.transform.SetParent(this.transform, false); graph = graphGO.GetComponent <WMG_Axis_Graph>(); graph.Init(); series1 = graph.addSeries(); graph.xAxis.AxisMaxValue = 28; if (useData2) { List <string> groups = new List <string>(); List <Vector2> data = new List <Vector2>(); for (int i = 0; i < series1Data2.Count; i++) { string[] row = series1Data2[i].Split(','); groups.Add(row[0]); if (!string.IsNullOrEmpty(row[1])) { float y = float.Parse(row[1]); data.Add(new Vector2(i + 1, y)); } } graph.groups.SetList(groups); graph.useGroups = true; graph.xAxis.LabelType = WMG_Axis.labelTypes.groups; graph.xAxis.AxisNumTicks = groups.Count; series1.seriesName = "Fruit Data"; series1.UseXDistBetweenToSpace = true; series1.pointValues.SetList(data); graph.Refresh(); } else { series1.pointValues.SetList(series1Data); } } //Start()
void Hello() { //删除自带的两个series barGraph.deleteSeries(); barGraph.deleteSeries(); //设置为柱形图 barGraph.graphType = WMG_Axis_Graph.graphTypes.bar_side; //y轴设置 barGraph.yAxis.hideGrid = true; // barGraph.yAxis.AxisMaxValue = 100; //y轴最大值,设为自动 barGraph.yAxis.AxisMinValue = 0; barGraph.yAxis.AxisNumTicks = 11; barGraph.yAxis.AxisLabelColor = new Color32(250, 238, 36, 255); //x轴设置 barGraph.xAxis.AxisNumTicks = 24; //0点到23点 barGraph.xAxis.hideGrid = true; barGraph.xAxis.LabelType = WMG_Axis.labelTypes.ticks; barGraph.xAxis.AxisLabelColor = new Color32(250, 238, 36, 255); series1 = barGraph.addSeries(); //自己添加series series1.comboType = WMG_Series.comboTypes.bar; series1.dataLabelsEnabled = true; series1.dataLabelsNumDecimals = 0; //主子图形上显示几位小数 series1.dataLabelsFontSize = 12; series1.dataLabelsColor = new Color32(250, 238, 36, 255); series1.dataLabelsOffset = new Vector2(0, 5); series1.UseXDistBetweenToSpace = true; series1.ManuallySetXDistBetween = true; series1.xDistBetweenPoints = 21.9f; //调整间距 series1.ManuallySetExtraXSpace = true; series1.extraXSpace = 0; series1.seriesName = "配电系统"; barGraph.Refresh(); }
void Hello() { todayUseAmount = transform.Find("todayUseAmount").GetComponent <Text>(); nowTemperature = transform.Find("nowTemperature").GetComponent <Text>(); nowPower = transform.Find("nowPower").GetComponent <Text>(); setTemperature = transform.Find("setTemperature").GetComponent <Text>(); nowState = transform.Find("nowState").GetComponent <Text>(); barGraph = GameObject.Find("LineGraphAir").GetComponent <WMG_Axis_Graph>(); //删除自带的两个series barGraph.deleteSeries(); barGraph.deleteSeries(); //设置为柱形图 barGraph.graphType = WMG_Axis_Graph.graphTypes.bar_side; //y轴设置 barGraph.yAxis.hideGrid = true; // barGraph.yAxis.AxisMaxValue = 10; barGraph.yAxis.AxisMinValue = 0; barGraph.yAxis.AxisNumTicks = 11; barGraph.yAxis.AxisLabelColor = new Color32(250, 238, 36, 255); //第二个y轴 //x轴设置 barGraph.xAxis.hideGrid = true; barGraph.xAxis.LabelType = WMG_Axis.labelTypes.ticks; barGraph.xAxis.AxisLabelColor = new Color32(250, 238, 36, 255); barGraph.xAxis.AxisNumTicks = 24; //0点到23点 series1 = barGraph.addSeries(); //自己添加series series1.comboType = WMG_Series.comboTypes.bar; series1.dataLabelsEnabled = true; series1.dataLabelsNumDecimals = 0; series1.dataLabelsFontSize = 12; series1.dataLabelsColor = new Color32(250, 238, 36, 255); series1.dataLabelsOffset = new Vector2(0, 5); series1.UseXDistBetweenToSpace = true; series1.ManuallySetXDistBetween = true; series1.xDistBetweenPoints = 21.7f; //柱形图间隔 series1.ManuallySetExtraXSpace = true; series1.extraXSpace = 0; series1.seriesName = "会议室空调"; //自动更新数字到x轴中 series1.UseXDistBetweenToSpace = true; barGraph.Refresh(); }
void Hello() { todayCharge = transform.Find("todayCharge").GetComponent <Text>(); todayOutputEnergy = transform.Find("todayOutputEnergy").GetComponent <Text>(); nowChargeDisPower = transform.Find("nowChargeDisPower").GetComponent <Text>(); todaySaveMoney = transform.Find("todaySaveMoney").GetComponent <Text>(); barGraph = GameObject.Find("LineGraphStorage").GetComponent <WMG_Axis_Graph>(); //删除自带的两个series barGraph.deleteSeries(); barGraph.deleteSeries(); //设置为柱形图 barGraph.graphType = WMG_Axis_Graph.graphTypes.bar_side; barGraph.axesType = WMG_Axis_Graph.axesTypes.I_IV; // 设置x轴,y轴样式 //y轴设置 barGraph.yAxis.hideGrid = true; //barGraph.yAxis.AxisMaxValue = 250; //barGraph.yAxis.AxisMinValue = -250; barGraph.yAxis.AxisNumTicks = 11; barGraph.yAxis.AxisLabelColor = new Color32(250, 238, 36, 255); //第二个y轴 //x轴设置 barGraph.xAxis.hideGrid = true; barGraph.xAxis.LabelType = WMG_Axis.labelTypes.ticks; barGraph.xAxis.AxisLabelColor = new Color32(250, 238, 36, 255); barGraph.xAxis.AxisNumTicks = 24; //0点到23点 series1 = barGraph.addSeries(); //自己添加series series1.comboType = WMG_Series.comboTypes.bar; series1.dataLabelsEnabled = true; series1.dataLabelsNumDecimals = 0; series1.dataLabelsFontSize = 10; //柱形图头上数字 series1.dataLabelsColor = new Color32(250, 238, 36, 255); series1.dataLabelsOffset = new Vector2(0, 13); series1.UseXDistBetweenToSpace = true; series1.ManuallySetXDistBetween = true; series1.xDistBetweenPoints = 22f; //调整间距 series1.ManuallySetExtraXSpace = true; series1.extraXSpace = 0; series1.seriesName = "储能系统"; barGraph.Refresh(); }
// sets extra variables not related to axis or positioning public void SetAllMiscellanious( bool resizeEnabled = true, bool autoPaddingEnabled = true, float autoPaddingAmount = 30f, bool legendOn = false, int legendFontSize = 40, float legendHeight = 55, bool animEnabled = false) { this.ResizeEnabled = resizeEnabled; this.AutoPaddingEnabled = autoPaddingEnabled; this.AutoPaddingAmount = autoPaddingAmount; this.LegendOn = legendOn; this.LegendFontSize = legendFontSize; this.LegendHeight = legendHeight; // note: DOTween animations sometimes do not work or raise errors. this.AnimEnabled = animEnabled; graph.Refresh(); }
public void fillGraphData() { WMG_Series series = graph.lineSeries[0].GetComponent <WMG_Series>(); series.seriesName = "GDP"; // should come from obj graph.graphTitleString = "GDP"; series.pointColor = Color.cyan; graph.yAxis.AxisMaxValue = history.Max() * 1.1f; graph.yAxis.AxisMinValue = history.Min() * 0.9f; graph.xAxis.AxisMaxValue = history.Count; graph.xAxis.AxisMinValue = 1; WMG_List <Vector2> pointValues = series.pointValues; pointValues.Clear(); float x = 0; for (int i = 0; i < history.Count; i++) { pointValues.Add(new Vector2(x++, history.Get(i))); } graph.Refresh(); }
void Hello() { amountOfchargeText = transform.Find("amountOfchargeText").GetComponent <Text>(); costOfChargeText = transform.Find("costOfChargeText").GetComponent <Text>(); lineGraph = GameObject.Find("LineGraphTest").GetComponent <WMG_Axis_Graph>(); lineGraph.graphType = WMG_Axis_Graph.graphTypes.bar_side; //设置为柱形图 //删除自带的两个series lineGraph.deleteSeries(); lineGraph.deleteSeries(); //y轴设置 // lineGraph.yAxis.AxisMaxValue = 15; lineGraph.yAxis.AxisNumTicks = 11; lineGraph.yAxis.AxisMinValue = 0; lineGraph.yAxis.hideTicks = false; //x轴设置 lineGraph.xAxis.AxisNumTicks = 24;//0~23 lineGraph.xAxis.LabelType = WMG_Axis.labelTypes.ticks; lineGraph.xAxis.AxisLabelColor = new Color32(250, 238, 36, 255); lineGraph.xAxis.hideTicks = false; series1 = lineGraph.addSeries(); //自己添加series series1.dataLabelsEnabled = true; //柱形图头顶数字显示 series1.dataLabelsNumDecimals = 0; series1.dataLabelsFontSize = 12; series1.dataLabelsColor = new Color32(250, 238, 36, 255); //头顶数字颜色 series1.seriesName = "充电桩"; series1.UseXDistBetweenToSpace = true; series1.ManuallySetXDistBetween = true; series1.xDistBetweenPoints = 21.7f; series1.ManuallySetExtraXSpace = true; series1.extraXSpace = 0; lineGraph.Refresh(); }
//数据接入 private void GetData() { pointvalues1.Clear(); xAxisLabels.Clear(); receiveData.GenerationData("geneCapacityPower"); // int j = 122; // x轴从4~22点开始 float max = 0; for (int i = 2; i < receiveData.geneData.Count; i += 4) { barGraph.xAxis.AxisNumTicks = int.Parse(receiveData.geneData[i]) - 3; xAxisLabels.Add(float.Parse(receiveData.geneData[i]).ToString("0")); pointvalues1.Add(new Vector2(float.Parse(receiveData.geneData[i]), float.Parse(receiveData.geneData[i + 2]))); float num = float.Parse(receiveData.geneData[i + 2]); if (max < num) { max = num; if (max <= 10) { max = 10; } else if (max > 10 && max <= 15) { max = 15f; } else if (max > 15 && max <= 30) { max = 30f; } else if (max > 30 && max <= 50) { max = 50f; } else if (max > 50 && max <= 100) { max = 100f; } else if (max > 100 && max <= 150) { max = 150f; } else if (max > 150 && max <= 200) { max = 200; } else if (max > 200 && max <= 250) { max = 250f; } else if (max > 250 && max <= 300) { max = 300f; } else { max = num; } barGraph.yAxis.AxisMaxValue = max; } } barGraph.xAxis.axisLabels.SetList(xAxisLabels); //把横坐标显示出来 series1.pointValues.SetList(pointvalues1); //把图显示出来 series1.pointColor = new Color32(86, 186, 255, 255); //标记点的颜色 barGraph.Refresh(); }
// Use this for initialization void Start() { GameObject lineGraphObj = Instantiate <WMG_Axis_Graph>(lineGraphPrefab).gameObject; lineGraphObj.transform.SetParent(GameObject.Find("Canvas").transform, worldPositionStays: false); lineGraphObj.transform.localPosition = Vector3.zero; lineGraphObj.transform.localScale = Vector3.one * 0.7f; lineGraphObj.GetComponent <RectTransform>().sizeDelta = lineGraphObj.transform.parent.GetComponent <RectTransform>().rect.size *0.3f; //全屏 lineGraph = lineGraphObj.GetComponent <WMG_Axis_Graph>(); lineGraph.Init(); WMG_List <Vector2> pointPosGZ = new WMG_List <Vector2>() { new Vector2(1f, 3f), new Vector2(2f, 20f), new Vector2(3f, 4f), new Vector2(4f, 13f), new Vector2(5f, 1f), new Vector2(6f, 4f), new Vector2(7f, 16f), new Vector2(8f, 5f), new Vector2(9f, 11f), new Vector2(10, 4f), new Vector2(11, 6f), new Vector2(12, 7f) }; WMG_List <Vector2> pointPosSZ = new WMG_List <Vector2> { new Vector2(1f, 16f), new Vector2(2f, 5f), new Vector2(3f, 11f), new Vector2(4, 4f), new Vector2(5, 6f), new Vector2(6, 7f), new Vector2(7f, 6), new Vector2(8f, 12f), new Vector2(9f, 7f), new Vector2(10, 15f), new Vector2(11, 12f), new Vector2(12, 3f) }; WMG_List <string> lineGroups = new WMG_List <string>() { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; // WMG_List<Color> lineColor = new WMG_List<Color>() { Color.red, Color.yellow, Color.green, Color.blue, Color.cyan, Color.black }; lineGraph.useGroups = true; lineGraph.groups.SetList(lineGroups); lineGraph.xAxis.axisLabels.SetList(lineGroups); //lineGraph.lineSeries = new List<GameObject>(); lineGraph.lineSeries[0].GetComponent <WMG_Series>().pointValues = pointPosGZ; lineGraph.lineSeries[1].GetComponent <WMG_Series>().pointValues = pointPosSZ; lineGraph.lineSeries[0].GetComponent <WMG_Series>().seriesName = "广州"; lineGraph.lineSeries[1].GetComponent <WMG_Series>().seriesName = "深圳"; lineGraph.xAxis.LabelType = WMG_Axis.labelTypes.ticks; lineGraph.axisWidth = 2; lineGraph.xAxis.hideGrid = true; lineGraph.yAxis.hideGrid = true; //lineGraph.graphType = WMG_Axis_Graph.graphTypes.bar_stacked; //lineGraph.orientationType = WMG_Axis_Graph.orientationTypes.horizontal; //lineGraph.resizeEnabled = true; //lineGraph.resizeProperties = WMG_Axis_Graph.ResizeProperties.AxesLabelOffset; //lineGraph.useGroups = true; //lineGraph.graphType = WMG_Axis_Graph.graphTypes.bar_side; //lineGraph.autoUpdateBarWidth = false; //lineGraph.autoUpdateBarAxisValue = false; //lineGraph.barWidth = 1f; //lineGraph.barAxisValue = 15f; //lineGraph.autoUpdateBarWidthSpacing = 0.1f; //lineGraph.resizeProperties = WMG_Axis_Graph.ResizeProperties.AutofitPadding; //lineGraph.resizeProperties = WMG_Axis_Graph.ResizeProperties.AxesLinePadding; //lineGraph.paddingLeftRight = new Vector2(70f, 50f); //lineGraph.paddingTopBottom = new Vector2(50f, 70f); //lineGraph.autoFitLabels = true; //lineGraph.autoFitPadding = 1f; //lineGraph.yAxis.AxisMinValue = 2f; //lineGraph.yAxis.AxisMaxValue = 13f; //lineGraph.yAxis.AxisNumTicks = 10; //lineGraph.yAxis.MinAutoGrow = true; //lineGraph.yAxis.MaxAutoGrow = true; //lineGraph.yAxis.MinAutoShrink = true; //lineGraph.yAxis.MaxAutoShrink = true; //lineGraph.yAxis.AxisLinePadding = 100f; //lineGraph.yAxis.HideAxisArrowTopRight = true; //lineGraph.yAxis.hideGrid = true; //lineGraph.yAxis.hideTick = true; //没卵用 //lineGraph.yAxis.hideTicks = true; lineGraph.yAxis.AxisTitleString = "出口"; //lineGraph.yAxis.AxisTitleOffset = new Vector2(30f, 30f); //lineGraph.yAxis.AxisTitleFontSize = 30; lineGraph.Refresh(); }
private void GetData() { pointvalues1.Clear(); xAxisLabels.Clear(); receiveData.PhotovoltaicWall("pvWall"); todayGeneEnergy.text = float.Parse(receiveData.photovoltaicWall[2]).ToString("0.0") + "kWh"; nowPower.text = float.Parse(receiveData.photovoltaicWall[4]).ToString("0.0") + "kW"; todayEqualHour.text = float.Parse(receiveData.photovoltaicWall[6]).ToString("0.0") + "h"; todayGenePowerProfit.text = float.Parse(receiveData.photovoltaicWall[8]).ToString("0.0") + "元"; float max = 0; for (int i = 27; i <= 99; i += 4) { xAxisLabels.Add(receiveData.photovoltaicWall[i]); //添加x坐标 pointvalues1.Add(new Vector2(float.Parse(receiveData.photovoltaicWall[i]), float.Parse(float.Parse(receiveData.photovoltaicWall[i + 2]).ToString("0")))); float num = float.Parse(float.Parse(receiveData.photovoltaicWall[i + 2]).ToString("0")); if (max <= num) { max = num; if (max <= 10) { max = 10; } else if (max > 10 && max <= 15) { max = 15f; } else if (max > 15 && max <= 30) { max = 30f; } else if (max > 30 && max <= 50) { max = 50f; } else if (max > 50 && max <= 100) { max = 100f; } else if (max > 100 && max <= 150) { max = 150f; } else if (max > 150 && max <= 200) { max = 200; } else if (max > 200 && max <= 250) { max = 250f; } else if (max > 250 && max <= 300) { max = 300f; } else { max = num; } barGraph.yAxis.AxisMaxValue = max; } } barGraph.xAxis.axisLabels.SetList(xAxisLabels); //把横坐标显示出来 series1.pointValues.SetList(pointvalues1); //把图显示出来 series1.pointColor = new Color32(86, 186, 255, 255); //标记点的颜色 barGraph.Refresh(); Invoke("FengXi", 0.5f); }
private void GetData() { pointvalues1.Clear(); xAxisLabels.Clear(); receiveData.ChargePile("chargePileAndFile"); amountOfchargeText.text = float.Parse(receiveData.chargeData[4]).ToString("0.0") + "kWh"; costOfChargeText.text = float.Parse(receiveData.chargeData[6]).ToString("0.0") + "元"; float max = 0; for (int i = 9; i < receiveData.chargeData.Count; i += 4) { xAxisLabels.Add(receiveData.chargeData[i]); //添加x坐标 pointvalues1.Add(new Vector2(float.Parse(receiveData.chargeData[i]), float.Parse(float.Parse(receiveData.chargeData[i + 2]).ToString("0")))); float num = float.Parse(float.Parse(receiveData.chargeData[i + 2]).ToString("0")); if (max <= num) //y轴动态设置 { max = num; if (max <= 10) { max = 10; } else if (max > 10 && max <= 15) { max = 15f; } else if (max > 15 && max <= 30) { max = 30f; } else if (max > 30 && max <= 50) { max = 50f; } else if (max > 50 && max <= 100) { max = 100f; } else if (max > 100 && max <= 150) { max = 150f; } else if (max > 150 && max <= 200) { max = 200; } else if (max > 200 && max <= 250) { max = 250f; } else if (max > 250 && max <= 300) { max = 300f; } else { max = num; } lineGraph.yAxis.AxisMaxValue = max; } } lineGraph.xAxis.axisLabels.SetList(xAxisLabels); //把横坐标显示出来 series1.pointValues.SetList(pointvalues1); //把图显示出来 series1.pointColor = new Color32(86, 186, 255, 255); //标记点的颜色 lineGraph.Refresh(); Invoke("FengXi", 0.5f); }
void GetData() { pointvalues1.Clear(); xAxisLabels.Clear(); receiveData.Storage("chargeDisAmount"); todayCharge.text = float.Parse(receiveData.storageData[1]).ToString("f1") + "kWh"; todayOutputEnergy.text = float.Parse(receiveData.storageData[3]).ToString("f1") + "kWh"; nowChargeDisPower.text = float.Parse(receiveData.storageData[5]).ToString("f1") + "kW"; todaySaveMoney.text = float.Parse(receiveData.storageData[7]).ToString("f1") + "元"; float max = 0; for (int i = 10; i <= receiveData.storageData.Count; i += 4) { xAxisLabels.Add(receiveData.storageData[i]); //添加x坐标 pointvalues1.Add(new Vector2(float.Parse(receiveData.storageData[i]), float.Parse(float.Parse(receiveData.storageData[i + 2]).ToString("0")))); float num = System.Math.Abs(float.Parse(float.Parse(receiveData.storageData[i + 2]).ToString("0"))); if (max <= num) { max = num; if (max <= 10) { max = 10; } else if (max > 10 && max <= 15) { max = 15f; } else if (max > 15 && max <= 30) { max = 30f; } else if (max > 30 && max <= 50) { max = 50f; } else if (max > 50 && max <= 100) { max = 100f; } else if (max > 100 && max <= 150) { max = 150f; } else if (max > 150 && max <= 200) { max = 200; } else if (max > 200 && max <= 250) { max = 250f; } else if (max > 250 && max <= 300) { max = 300f; } else { max = num; } barGraph.yAxis.AxisMaxValue = max; barGraph.yAxis.AxisMinValue = -max; } } barGraph.xAxis.axisLabels.SetList(xAxisLabels); //把横坐标显示出来 series1.pointValues.SetList(pointvalues1); //把图显示出来 series1.pointColor = new Color32(86, 186, 255, 255); //标记点的颜色 barGraph.Refresh(); Invoke("FengXi", 0.5f); }
void GetData() { pointvalues1.Clear(); xAxisLabels.Clear(); receiveData.AirConditoner("meetingRoomCondition"); todayUseAmount.text = float.Parse(receiveData.airData[2]).ToString("f1") + "kWh"; nowTemperature.text = float.Parse(receiveData.airData[4]).ToString("f1") + "℃"; nowPower.text = float.Parse(receiveData.airData[6]).ToString("f1") + "kW"; setTemperature.text = float.Parse(receiveData.airData[8]).ToString("f1") + "℃"; nowState.text = receiveData.airData[10].ToString(); float max = 0; for (int i = 13; i <= 106; i += 4) { xAxisLabels.Add(receiveData.airData[i]); //添加x坐标 pointvalues1.Add(new Vector2(float.Parse(receiveData.airData[i]), float.Parse(float.Parse(receiveData.airData[i + 2]).ToString("0")))); float num = float.Parse(float.Parse(receiveData.airData[i + 2]).ToString("0")); if (max <= num) { max = num; if (max <= 10) { max = 10; } else if (max > 10 && max <= 15) { max = 15f; } else if (max > 15 && max <= 30) { max = 30f; } else if (max > 30 && max <= 50) { max = 50f; } else if (max > 50 && max <= 100) { max = 100f; } else if (max > 100 && max <= 150) { max = 150f; } else if (max > 150 && max <= 200) { max = 200; } else if (max > 200 && max <= 250) { max = 250f; } else if (max > 250 && max <= 300) { max = 300f; } else { max = num; } barGraph.yAxis.AxisMaxValue = max; } } barGraph.xAxis.axisLabels.SetList(xAxisLabels); //把横坐标显示出来 series1.pointValues.SetList(pointvalues1); //把图显示出来 series1.pointColor = new Color32(86, 186, 255, 255); //标记点的颜色 barGraph.Refresh(); Invoke("FengXi", 0.5f); }