private void AnalysisData(ProductPassRate product) { var fields = typeof(ProductPassRate).GetFields(); for (int i = 0; i < fields.Length; i++) { switch (fields[i].Name) { case "ID": int id = (int)fields[i].GetValue(product); dataIdList.Add(id); break; case "productName": string n = (string)fields[i].GetValue(product); dataNameList.Add(n); break; case "passRate": float q = (float)fields[i].GetValue(product); dataPassRateList.Add(q); break; default: break; } } }
void CreateOrDeleteSlicesBasedOnValues() { LabelToSliceMap.Clear(); // Create pie slices based on sliceValues data for (int i = 0; i < numSlices; i++) { if (sliceLabels.Count <= i) { sliceLabels.Add(""); } if (sliceColors.Count <= i) { sliceColors.Add(Color.white); } if (slices.Count <= i) { GameObject curObj = CreateNode(nodePrefab, slicesParent); slices.Add(curObj); WMG_Pie_Graph_Slice pieSlice = curObj.GetComponent <WMG_Pie_Graph_Slice>(); pieSlice.pieRef = this; pieSlice.sliceIndex = i; if (useDoughnut) { setTexture(pieSlice.objectToColor, pieSprite); setTexture(pieSlice.objectToMask, pieSprite); } if (interactivityEnabled) { pieSlice.objectToColor.AddComponent <WMG_Raycatcher>(); setAsNotInteractible(pieSlice.objectToLabel); } addPieSliceMouseEnterEvent(pieSlice.objectToColor); addPieSliceClickEvent(pieSlice.objectToColor); } if (legend.legendEntries.Count <= i) { WMG_Legend_Entry legendEntry = legend.createLegendEntry(legendEntryPrefab); addPieLegendEntryClickEvent(legendEntry.gameObject); } } for (int i = slices.Count - 1; i >= 0; i--) { if (slices[i] != null && i >= numSlices) { WMG_Pie_Graph_Slice theSlice = slices[i].GetComponent <WMG_Pie_Graph_Slice>(); DeleteNode(theSlice); slices.RemoveAt(i); } } // If there are more sliceLegendEntries or slices than sliceValues data, delete the extras for (int i = legend.legendEntries.Count - 1; i >= 0; i--) { if (legend.legendEntries[i] != null && i >= numSlices) { legend.deleteLegendEntry(i); } } }
void GetData() { //圈角度的确定 Rotation(97 ~ -263) ===> (0 ~ 360) ===> (0 ~ 100) // circleGF.rotation = Quaternion.Euler(0, 0, r0 - (mf * receiveData.DownloadData("genePowerRate", "strpvGenePercent"))); // circleCN.rotation = Quaternion.Euler(0, 0, r0 - (mf * receiveData.DownloadData("genePowerRate", "strseGenePercent"))); // circleDW.rotation = Quaternion.Euler(0, 0, r0 - (mf * receiveData.DownloadData("genePowerRate", "strpnGenePercent"))); //清空 sliceValuesCN.Clear(); sliceValuesDW.Clear(); sliceValuesGF.Clear(); pieGraphGF.sliceValues.Clear(); pieGraphCN.sliceValues.Clear(); pieGraphDW.sliceValues.Clear(); GF_Percent.text = ""; CN_Percent.text = ""; DW_Percent.text = ""; GF.text = ""; CN.text = ""; DW.text = ""; //赋值 sliceValuesGF.Add(receiveData.DownloadData("genePowerRate", "strpvGenePercent")); sliceValuesGF.Add(100 - receiveData.DownloadData("genePowerRate", "strpvGenePercent")); sliceValuesCN.Add(receiveData.DownloadData("genePowerRate", "strseGenePercent")); sliceValuesCN.Add(100 - receiveData.DownloadData("genePowerRate", "strseGenePercent")); sliceValuesDW.Add(receiveData.DownloadData("genePowerRate", "strpnGenePercent")); sliceValuesDW.Add(100 - receiveData.DownloadData("genePowerRate", "strpnGenePercent")); pieGraphGF.sliceValues.SetList(sliceValuesGF); pieGraphCN.sliceValues.SetList(sliceValuesCN); pieGraphDW.sliceValues.SetList(sliceValuesDW); GF_Percent.text = receiveData.ReturnData("genePowerRate", "strpvGenePercent") + "%"; CN_Percent.text = receiveData.ReturnData("genePowerRate", "strseGenePercent") + "%"; DW_Percent.text = receiveData.ReturnData("genePowerRate", "strpnGenePercent") + "%"; GF.text = receiveData.ReturnData("genePowerRate", "photovoltaicGenerate") + "kWh"; CN.text = receiveData.ReturnData("genePowerRate", "storedEnergyGenerate") + "kWh"; DW.text = receiveData.ReturnData("genePowerRate", "powerNetworkGenerate") + "kWh"; pieGraphGF.Refresh(); pieGraphCN.Refresh(); pieGraphDW.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 GetData() { sliceLabels.Clear(); sliceValues.Clear(); sliceColors.Clear(); //设置序列名、数值(会自动求比例的)、颜色 sliceLabels.Add("动力"); sliceLabels.Add("充电"); sliceLabels.Add("空调"); sliceLabels.Add("其他"); sliceLabels.Add("照明"); sliceLabels.Add("储能"); sliceValues.Add(receiveData.DownloadData("usePowerRate", "power")); sliceValues.Add(receiveData.DownloadData("usePowerRate", "charge")); sliceValues.Add(receiveData.DownloadData("usePowerRate", "airConditioner")); sliceValues.Add(receiveData.DownloadData("usePowerRate", "others")); sliceValues.Add(receiveData.DownloadData("usePowerRate", "lighting")); sliceValues.Add(receiveData.DownloadData("usePowerRate", "storedEnergy")); sliceColors.Add(new Color32(86, 186, 255, 255)); sliceColors.Add(new Color32(123, 223, 252, 255)); sliceColors.Add(new Color32(86, 186, 255, 255)); sliceColors.Add(new Color32(123, 223, 252, 255)); sliceColors.Add(new Color32(86, 186, 255, 255)); sliceColors.Add(new Color32(123, 223, 252, 255)); pieGraph.sliceValues.SetList(sliceValues); pieGraph.sliceLabels.SetList(sliceLabels); pieGraph.sliceColors.SetList(sliceColors); }
void Hello() { //初始化 pieGraphGF.Init(); pieGraphCN.Init(); pieGraphDW.Init(); //使能 pieGraphGF.resizeEnabled = true; pieGraphCN.resizeEnabled = true; pieGraphDW.resizeEnabled = true; //不裂缝 pieGraphGF.explodeLength = 0; pieGraphCN.explodeLength = 0; pieGraphDW.explodeLength = 0; //不掏空 pieGraphGF.useDoughnut = false; pieGraphCN.useDoughnut = false; pieGraphDW.useDoughnut = false; //自动居中 pieGraphGF.autoCenter = true; pieGraphCN.autoCenter = true; pieGraphDW.autoCenter = true; //摆放顺序 pieGraphGF.sortBy = WMG_Pie_Graph.sortMethod.None; pieGraphCN.sortBy = WMG_Pie_Graph.sortMethod.None; pieGraphDW.sortBy = WMG_Pie_Graph.sortMethod.None; //饼状图中百分比显示样式 pieGraphGF.sliceLabelType = WMG_Enums.labelTypes.None; pieGraphCN.sliceLabelType = WMG_Enums.labelTypes.None; pieGraphDW.sliceLabelType = WMG_Enums.labelTypes.None; //饼状图大小 pieGraphGF.autoCenterMinPadding = 9f; pieGraphCN.autoCenterMinPadding = 9f; pieGraphDW.autoCenterMinPadding = 9f; pieGraphGF.bgCircleOffset = 1f; pieGraphCN.bgCircleOffset = 1f; pieGraphDW.bgCircleOffset = 1f; //设置饼状图名称 sliceLabelsGF.Add("光伏"); sliceLabelsGF.Add("光伏_"); sliceLabelsCN.Add("储能"); sliceLabelsCN.Add("储能_"); sliceLabelsDW.Add("电网"); sliceLabelsDW.Add("电网_"); //设置饼状图颜色 sliceColorsGF.Add(new Color32(84, 176, 241, 255)); sliceColorsGF.Add(new Color32(43, 54, 84, 0)); sliceColorsCN.Add(new Color32(121, 220, 248, 255)); sliceColorsCN.Add(new Color32(43, 54, 84, 0)); sliceColorsDW.Add(new Color32(84, 176, 241, 255)); sliceColorsDW.Add(new Color32(43, 54, 84, 0)); //赋值给最终显示 pieGraphGF.sliceLabels.Clear(); pieGraphCN.sliceLabels.Clear(); pieGraphDW.sliceLabels.Clear(); pieGraphGF.sliceColors.Clear(); pieGraphCN.sliceColors.Clear(); pieGraphDW.sliceColors.Clear(); pieGraphGF.sliceLabels.SetList(sliceLabelsGF); pieGraphCN.sliceLabels.SetList(sliceLabelsCN); pieGraphDW.sliceLabels.SetList(sliceLabelsDW); pieGraphGF.sliceColors.SetList(sliceColorsGF); pieGraphCN.sliceColors.SetList(sliceColorsCN); pieGraphDW.sliceColors.SetList(sliceColorsDW); pieGraphGF.Refresh(); pieGraphCN.Refresh(); pieGraphDW.Refresh(); }
void GetData() { pointvalues1.Clear(); xAxisLabels.Clear(); receiveData.PowerSys("powerDistriSystem"); todayUsePowerAmount.text = float.Parse(receiveData.powerData[receiveData.powerData.Count - 13]).ToString("f1") + "kWh"; nowLoad.text = float.Parse(receiveData.powerData[receiveData.powerData.Count - 11]).ToString("f1") + "kW"; todayPowerMoney.text = float.Parse(receiveData.powerData[receiveData.powerData.Count - 9]).ToString("f1") + "元"; float max = 0; for (int i = 2; i <= receiveData.powerData.Count - 17; i += 4) { xAxisLabels.Add(receiveData.powerData[i]); //添加x坐标 pointvalues1.Add(new Vector2(float.Parse(receiveData.powerData[i]), float.Parse(float.Parse(receiveData.powerData[i + 2]).ToString("0")))); float num = float.Parse(float.Parse(receiveData.powerData[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.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.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); }
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); }
//数据接入 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(); }