public override void Init(ManagerBase manager) { base.Init(manager); Subscribe((int)MessageUIConst.OpenProductDetailPanel, (arg) => { Control(arg); }); costGraph.Init(); costGraph.yAxis.LabelType = WMG_Axis.labelTypes.ticks; costGraph.yAxis.MaxAutoGrow = true; costGraph.yAxis.AxisNumTicks = 6; costGraph.yAxis.AxisMaxValue = 1; costGraph.tooltipDisplaySeriesName = true; costGraph.xAxis.AxisNumTicks = 12; costS1 = costGraph.addSeries(); costS1.UseXDistBetweenToSpace = true; costS1.seriesName = "固定成本"; costS2 = costGraph.addSeries(); costS2.UseXDistBetweenToSpace = true; costS2.seriesName = "非固定成本"; costS1.pointColor = Color.red; costS2.pointColor = Color.green; IsON = false; gameObject.SetActive(IsON); }
void Start() { //setup for graphs canvas = GameObject.Find("RoomInfoPanel"); graphGO = GameObject.Instantiate(emptyGraphPrefab); //test attaching graph to a panel graphGO.transform.SetParent(canvas.transform, false); graph = graphGO.GetComponent <WMG_Axis_Graph> (); series1 = graph.addSeries(); series2 = graph.addSeries(); series3 = graph.addSeries(); series4 = graph.addSeries(); MakeSeriesList(); series1.pointValues.SetList(series1Data); series2.pointValues.SetList(series2Data); series3.pointValues.SetList(series3Data); series4.pointValues.SetList(series4Data); series1.seriesName = "Room 2003 Temp"; series2.seriesName = "Setpoint"; series3.seriesName = "Maximum Temp"; series4.seriesName = "Minimum Temp"; g = new Gradient(); GradientColorKey[] gck = gameObject.GetComponent <roomManager> ().g.colorKeys; //get colors not the alphas of the room gradient //create the alpha keys (100% alpha) GradientAlphaKey[] gak = new GradientAlphaKey[2]; gak[0].alpha = 1.0f; gak [1].alpha = 1.0f; gak[0].time = 0.0f; gak [1].time = 1.0f; //set the keys g.SetKeys(gck, gak); float eval = Mathf.InverseLerp(lt, ht, sp); //assuming lt and ht correspond to those numbers in room Manager script series2.lineColor = g.Evaluate(eval); series2.pointColor = g.Evaluate(eval); series3.lineColor = g.Evaluate(1); series3.pointColor = g.Evaluate(1); series4.lineColor = g.Evaluate(0); series4.pointColor = g.Evaluate(0); //used to investigate how the labels are made in Graph_Maker package // List<WMG_Node> myLabels = new List<WMG_Node>(); // myLabels = graph.xAxis.GetAxisLabelNodes (); // // print ("there are " + myLabels.Count + " x axis labels"); // foreach (WMG_Node n in myLabels) { // print ("here is a list of labels for x axis "); // } input.onEndEdit.AddListener(SetPoints); }
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(); }
public override void Init(ManagerBase manager) { base.Init(manager); graph.useGroups = true; graph.yAxis.LabelType = WMG_Axis.labelTypes.groups; graph.tooltipDisplaySeriesName = true; graph.WMG_Click += BarGraph_WMG_Click; WMG_Series s1;//定义Series if (graph.lineSeries.Count == 0) { s1 = graph.addSeries();//如果该图标下没有series,就添加一个,并绑定为s1 } else { s1 = graph.lineSeries[0].GetComponent <WMG_Series>();//如果有,把第一个绑定为s1 } s1.dataLabelsNumDecimals = 2; s1.seriesName = "产量"; //设置名称,该名称为tooltip显示的名称 s1.dataLabelsFontSize = 14; //设置字号,该字号为条后的计量数字字号 s1.dataLabelsOffset = new Vector2(2, 5); //设置偏移,该偏移为条后的计量数字位置偏移 if (s1.usePointColors) { s1.pointColors.SetList(ColorDatas.Instance.productOutputColors.DataColorList);//如果应用了colors,则使用颜色数据的列表 } else { s1.pointColor = ColorDatas.Instance.productOutputColors.DataColorList[0]; //如果没有应用colors,则使用颜色数据列表的第一个 } s1.dataLabelsEnabled = true; //显示前面的标签 }
// Start is called before the first frame update void Start() { // start file Debug.Log("d:\\simdata\\" + savefile); using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"d:\simdata\" + savefile, true)) { file.WriteLine("Year, Total catch, Total profit, Total resource, Resource regen"); } yearlyCatchGraph = yearlyCatchGraphPrefab.GetComponent <WMG_Axis_Graph>(); catchDataSeries = yearlyCatchGraph.addSeries(); catchDataSeries.pointValues.SetList(catchData); yearlyProfitGraph = yearlyProfitGraphPrefab.GetComponent <WMG_Axis_Graph>(); profitDataSeries = yearlyProfitGraph.addSeries(); profitDataSeries.pointValues.SetList(profitData); yearlyResourceGraph = yearlyResourceGraphPrefab.GetComponent <WMG_Axis_Graph>(); resourceSeries = yearlyResourceGraph.addSeries(); resourceSeries.pointValues.SetList(resourceData); yearlyAddedResourceGraph = yearlyAddedResourceGraphPrefab.GetComponent <WMG_Axis_Graph>(); addedResourceSeries = yearlyAddedResourceGraph.addSeries(); addedResourceSeries.pointValues.SetList(addedResourceData); // instantiateGraph(yearlyResourceGraphPrefab, yearlyResourceGraph, resourceData, resourceSeries); //instantiateGraph(yearlyAddedResourceGraphPrefab, yearlyAddedResourceGraph, addedResourceData, addedResourceSeries); }
// Use this for initialization void Start() { GameObject graphGO = GameObject.Instantiate(emptyGraphPrefab); graphGO.transform.SetParent(this.transform, false); graph = graphGO.GetComponent <WMG_Axis_Graph>(); graph.stretchToParent(graphGO); graph.Init(); graph.graphType = WMG_Axis_Graph.graphTypes.line_stacked; graph.useGroups = true; List <string> groups = new List <string>() { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20" }; graph.groups.SetList(groups); for (int i = 0; i < numSeries; i++) { WMG_Series series = graph.addSeries(); series.lineColor = new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f), 1); series.pointColor = series.lineColor; series.UseXDistBetweenToSpace = true; int numPoints = Random.Range(maxNumPoints / 2, maxNumPoints); series.pointValues.SetList(WMG_Util.GenRandomY(numPoints, maxNumPoints - numPoints + 1, maxNumPoints, graph.yAxis.AxisMinValue / numSeries, graph.yAxis.AxisMaxValue / numSeries)); } }
// Start is called before the first frame update void Start() { SERIES1 = graph.addSeries(); offices = cgs.placedOffice; homes = cgs.placedHome; points.Add(new Vector2(timer, patients)); for (int i = 1; i <= samplesize; i++) { Vector3 position = new Vector3(UnityEngine.Random.Range(-22, -60), 17, UnityEngine.Random.Range(-1, -167)); GameObject temp = Instantiate(playerprefab, homes[UnityEngine.Random.Range(69, 1420)].transform.position, Quaternion.identity); if (i < 6) { temp.GetComponent <playerController>().covidstatus = 1; } else { temp.GetComponent <playerController>().covidstatus = UnityEngine.Random.Range(0, 100); } temp.GetComponent <playerController>().playerid = i; } humans = GameObject.FindGameObjectsWithTag("human"); }
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(); }
// add main data series for graph void AddGraphSeries() { dataSeries = graph.addSeries(); dataSeries.seriesName = title; dataSeries.hideLines = !hasPointConnectLine; dataSeries.lineScale = 4; dataSeries.pointWidthHeight = 30; }
// Use this for initialization void Start() { changeObjs.Add(plottingDataC); GameObject graphGO = GameObject.Instantiate(emptyGraphPrefab) as GameObject; graphGO.transform.SetParent(this.transform, false); graph = graphGO.GetComponent <WMG_Axis_Graph>(); graph.legend.hideLegend = true; graph.stretchToParent(graphGO); graphOverlay = new GameObject(); graphOverlay.AddComponent <RectTransform>(); graphOverlay.name = "Graph Overlay"; graphOverlay.transform.SetParent(graphGO.transform, false); indicatorGO = GameObject.Instantiate(indicatorPrefab) as GameObject; indicatorGO.transform.SetParent(graphOverlay.transform, false); indicatorGO.SetActive(false); graph.GraphBackgroundChanged += UpdateIndicatorSize; graph.autoPaddingEnabled = false; graph.paddingLeftRight = new Vector2(65, 60); graph.paddingTopBottom = new Vector2(40, 40); graph.xAxis.LabelType = WMG_Axis.labelTypes.ticks; graph.xAxis.SetLabelsUsingMaxMin = true; graph.autoAnimationsEnabled = false; graph.xAxis.hideLabels = true; graph.xAxis.hideTicks = true; graph.xAxis.hideGrid = !moveVerticalGridLines; graph.yAxis.AxisNumTicks = 5; graph.yAxis.hideTicks = true; graph.axisWidth = 1; graph.yAxis.AutoGrowShrinkType = WMG_Axis.autoGrowShrinkType.DATA_MIN_MAX; graph.yAxis.MaxAutoGrow = true; // auto increase yAxis max if a point value exceeds max graph.yAxis.MinAutoGrow = true; // auto decrease yAxis min if a point value exceeds min series1 = graph.addSeries(); series1.pointColor = Color.red; series1.lineColor = Color.green; series1.lineScale = 0.5f; series1.pointWidthHeight = 8; if (useAreaShading) { series1.areaShadingType = WMG_Series.areaShadingTypes.Gradient; series1.areaShadingAxisValue = graph.yAxis.AxisMinValue; series1.areaShadingColor = new Color(80f / 255f, 100f / 255f, 60f / 255f, 1f); series1.areaShadingUsesComputeShader = useComputeShader; } graph.tooltipDisplaySeriesName = false; // define our own custom functions for labeling graph.theTooltip.tooltipLabeler = customTooltipLabeler; // override the default labeler for the tooltip graph.yAxis.axisLabelLabeler = customYAxisLabelLabeler; // override the default labeler for the yAxis series1.seriesDataLabeler = customSeriesDataLabeler; // override the default labeler for data labels (appear over points when data labels on the series are enabled) plottingDataC.OnChange += PlottingDataChanged; if (plotOnStart) { plottingData = true; } }
// 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()
public void addSerie(List <Vector2> values) { WMG_Series serie; serie = graph.addSeries(); serie.pointColor = getRandomColor(); serie.seriesName = "Circulo2"; serie.pointValues.SetList(values); }
public void init() { graphGO = GameObject.Instantiate(emptyGraphPrefab); graphGO.transform.SetParent(this.transform, false); graph = graphGO.GetComponent <WMG_Axis_Graph>(); //series1 = graph.addSeries(); //X轴最大数数 graph.xAxis.AxisMaxValue = 20; //是否使用自动动画 graph.autoAnimationsEnabled = false; //X轴隐藏显示内容 graph.xAxis.hideLabels = true; //Y轴隐藏显示内容 graph.yAxis.hideLabels = false; ////Y轴最大数值 //graph.yAxis.AxisMaxValue = 20; //Y轴Label字体大小 graph.yAxis.AxisLabelSize = 18; //Y轴长度分割点数量 graph.yAxis.AxisNumTicks = 5; // Y轴最大值自动生长 graph.yAxis.MaxAutoGrow = true; // Y轴最小值自动生长 graph.yAxis.MinAutoGrow = true; graph.yAxis.MaxAutoShrink = true; System.Globalization.NumberFormatInfo yAxisNumberFormatInfo = new System.Globalization.CultureInfo("en-US", false).NumberFormat; series1 = graph.addSeries(); series1.seriesName = "名称"; series1.pointColor = Color.red; series1.lineColor = Color.green; series1.lineScale = 0.5f; series1.pointWidthHeight = 8; graph.yAxis.axisLabelLabeler = customAxisLabelLabelerToE; //颜色区域 if (useAreaShading) { series1.areaShadingType = WMG_Series.areaShadingTypes.Gradient; series1.areaShadingAxisValue = graph.yAxis.AxisMinValue; series1.areaShadingColor = new Color(80f / 255f, 100f / 255f, 60f / 255f, 1f); } graphOverlay = new GameObject(); graphOverlay.AddComponent <RectTransform>(); graphOverlay.name = "Graph Overlay"; graphOverlay.transform.SetParent(graphGO.transform, false); indicatorGO = GameObject.Instantiate(indicatorPrefab) as GameObject; indicatorGO.transform.SetParent(graphOverlay.transform, false); indicatorGO.SetActive(false); graph.GraphBackgroundChanged += UpdateIndicatorSize; graph.paddingLeftRight = new Vector2(65, 60); graph.paddingTopBottom = new Vector2(40, 40); }
// Use this for initialization void Start() { GameObject graphGO = GameObject.Instantiate(emptyGraphPrefab) as GameObject; graphGO.transform.SetParent(this.transform, false); graph = graphGO.GetComponent <WMG_Axis_Graph>(); graph.legend.hideLegend = true; graph.changeSpriteSize(graphGO, 800, 600); graph.axesType = WMG_Axis_Graph.axesTypes.CENTER; graph.yAxis.AxisMinValue = -20; graph.yAxis.AxisMaxValue = 20; graph.yAxis.AxisNumTicks = 11; graph.yAxis.numDecimalsAxisLabels = 2; // auto grow / shrink the y-axis min and max values based on series data graph.yAxis.MaxAutoGrow = true; graph.yAxis.MaxAutoShrink = true; graph.yAxis.MinAutoGrow = true; graph.yAxis.MinAutoShrink = true; graph.xAxis.AxisMinValue = -10; graph.xAxis.AxisMaxValue = 10; graph.xAxis.AxisNumTicks = 11; graph.xAxis.MaxAutoGrow = true; graph.xAxis.MaxAutoShrink = true; graph.xAxis.MinAutoGrow = true; graph.xAxis.MinAutoShrink = true; graph.xAxis.LabelType = WMG_Axis.labelTypes.ticks; graph.xAxis.SetLabelsUsingMaxMin = true; series = graph.addSeries(); series.lineScale = 0.5f; series.pointColor = Color.red; series.linePadding = 0.2f; List <string> operatorsAndParentheses = new List <string>(new string[] { @"\(", @"\)", @"\+", "-", @"\*", "/", @"\^", "sqrt", "abs", "log", "ln", "sin", "cos", "tan" }); string operatorAndParenthesesRegexStr = " ?("; for (int i = 0; i < operatorsAndParentheses.Count; i++) { operatorAndParenthesesRegexStr += "("; operatorAndParenthesesRegexStr += operatorsAndParentheses[i]; if (i == operatorsAndParentheses.Count - 1) { operatorAndParenthesesRegexStr += ")"; } else { operatorAndParenthesesRegexStr += ")|"; } } operatorAndParenthesesRegexStr += ") ?"; operatorAndParenthesesRegex = new Regex(operatorAndParenthesesRegexStr); decimalsMultiplier = Mathf.Pow(10f, numDecimalsToRound); }
void Start() { //graphGO = GameObject.Instantiate(emptyGraphPrefab); //graphGO.transform.SetParent(this.transform, false); //graphGO.SetActive(graph_enabled); graph = graphGO.GetComponent <WMG_Axis_Graph>(); series1 = graph.addSeries(); series2 = graph.addSeries(); series2.pointColor = new Color(0, 230, 0); series2.lineColor = new Color(0, 230, 0); series2.enabled = rec_enabled; graph.xAxis.AxisMinValue = 20; graph.xAxis.AxisMaxValue = 0; graph.autoUpdateOrigin = false; graph.theOrigin = new Vector2(0f, 0f); graph.xAxis.AxisTitleString = "Time"; graph.xAxis.hideLabels = true; graph.autoShrinkAtPercent = 0f; graph.autoAnimationsEnabled = false; coroutine_time = 0.15f;//otherScript.coroutine_wait; otherScript = CubeObject.GetComponent <ChangeColor>(); rec_behavior = RecElectrode.GetComponent <ElectrodeBehavior>(); data = new List <Vector2>(); data2 = new List <Vector2>(); dataStore = new List <Vector2>(); data2Store = new List <Vector2>(); cur_pos = graphGO.GetComponent <Transform>().localPosition; //series1.enabled = graph_enabled; //graphGO.SetActive(graph_enabled); //ToggleGraph(); StartCoroutine(DisableGraph()); //series1.pointValues //graph.xAxis.AxisMaxValue = x; }
void addSeriesWithNewData() { WMG_Series series = graph.addSeries(); series.UseXDistBetweenToSpace = true; series.AutoUpdateXDistBetween = true; series.lineScale = 0.5f; series.pointColor = Color.blue; series.seriesName = "Series " + graph.lineSeries.Count; series.pointValues = newSeries;//graph.GenRandomY(graph.groups.Count, 1, graph.groups.Count, graph.yAxisMinValue, graph.yAxisMaxValue); }
private void AddPointToGraph(WMG_Axis_Graph graph, List <float> pointList, string GraphName, float yScale) { WMG_Series serie = graph.addSeries(); for (int i = 0; i < pointList.Count; i++) { serie.pointValues.Add(new Vector2(i, pointList[i])); } serie.pointColor = Color.red; serie.seriesName = GraphName; graph.yAxis.AxisMaxValue = yScale; }
// Use this for initialization void Start () { changeObjs.Add(plottingDataC); GameObject graphGO = GameObject.Instantiate(emptyGraphPrefab) as GameObject; graphGO.transform.SetParent(this.transform, false); graph = graphGO.GetComponent<WMG_Axis_Graph>(); graph.legend.hideLegend = true; graph.stretchToParent(graphGO); graphOverlay = new GameObject(); graphOverlay.AddComponent<RectTransform>(); graphOverlay.name = "Graph Overlay"; graphOverlay.transform.SetParent(graphGO.transform, false); indicatorGO = GameObject.Instantiate(indicatorPrefab) as GameObject; indicatorGO.transform.SetParent(graphOverlay.transform, false); indicatorGO.SetActive(false); graph.GraphBackgroundChanged += UpdateIndicatorSize; graph.paddingLeftRight = new Vector2(65, 60); graph.paddingTopBottom = new Vector2(40, 40); graph.xAxis.LabelType = WMG_Axis.labelTypes.ticks; graph.xAxis.SetLabelsUsingMaxMin = true; graph.autoAnimationsEnabled = false; graph.xAxis.hideLabels = true; graph.xAxis.hideTicks = true; graph.xAxis.hideGrid = true; graph.yAxis.AxisNumTicks = 5; graph.yAxis.hideTicks = true; graph.axisWidth = 1; graph.yAxis.MaxAutoGrow = true; // auto increase yAxis max if a point value exceeds max graph.yAxis.MinAutoGrow = true; // auto decrease yAxis min if a point value exceeds min series1 = graph.addSeries(); series1.pointColor = Color.red; series1.lineColor = Color.green; series1.lineScale = 0.5f; series1.pointWidthHeight = 8; graph.changeSpriteColor(graph.graphBackground, Color.black); if (useAreaShading) { series1.areaShadingType = WMG_Series.areaShadingTypes.Gradient; series1.areaShadingAxisValue = graph.yAxis.AxisMinValue; series1.areaShadingColor = new Color(80f/255f, 100f/255f, 60f/255f, 1f); } graph.tooltipDisplaySeriesName = false; // define our own custom functions for labeling graph.theTooltip.tooltipLabeler = customTooltipLabeler; // override the default labeler for the tooltip graph.yAxis.axisLabelLabeler = customYAxisLabelLabeler; // override the default labeler for the yAxis series1.seriesDataLabeler = customSeriesDataLabeler; // override the default labeler for data labels (appear over points when data labels on the series are enabled) plottingDataC.OnChange += PlottingDataChanged; if (plotOnStart) { plottingData = true; } }
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(); }
public void Init(int ch, string channelName, WMG_Axis_Graph graph) { channel = ch; TextChannelName.text = channel + ". " + channelName; TextChannelName.color = Colours[ch - 1]; for (int i = 0; i < 24; i++) { Transform tb = Instantiate(PrefabTimeBlock); tb.SetParent(TimeBlockParent, false); } graphSeries = graph.addSeries(); graphSeries.seriesName = channelName; graphSeries.lineColor = Colours[ch - 1]; }
public void set(GameObject graphGO, Vector3 position) { groups = new List <string>(); data = new List <Vector2>(); graphGO.transform.SetParent(Graphs.transform, false); graphGO.transform.localScale = graphGO.transform.localScale * 1.2f; graphGO.transform.Translate(Vector3.up * 0.3f, Space.World); BackGround1 = GameObject.Find("Sprite_Black"); // 검은색 BackGround1.transform.position += new Vector3(-0.3f, 0.7f, 0); graph = graphGO.GetComponent <WMG_Axis_Graph>(); series1 = graph.addSeries(); graph.xAxis.AxisMaxValue = 5; if (useData2) { 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 = "Range Data"; series1.UseXDistBetweenToSpace = true; series1.pointColor = HexToColor("57CFEF"); series1.lineColor = HexToColor("FFFFFF"); series1.pointValues.SetList(data); } else { series1.pointValues.SetList(series1Data); } // graphGO.SetActive(false); graphGO.transform.position = position; }
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(); }
void Start() { GameObject graphGO = GameObject.Instantiate(emptyGraph); graphGO.transform.SetParent(this.transform, false); graph = graphGO.GetComponent <WMG_Axis_Graph>(); series1 = graph.addSeries(); graph.xAxis.AxisMaxValue = 5; //graph.xAxis.AxisNumTicks = 10; 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(','); Debug.Log(row[0]); 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.AutoUpdateXDistBetween = true; series1.pointValues.SetList(data); } else { series1.pointValues.SetList(series1Data); } }
// Use this for initialization void Start() { GameObject graphGO = GameObject.Instantiate(emptyGraphPrefab); graphGO.transform.SetParent(this.transform, false); graph = graphGO.GetComponent <WMG_Axis_Graph>(); graph.stretchToParent(graphGO); graph.xAxis.AxisMinValue = 0; graph.yAxis.AxisMinValue = 0; graph.xAxis.AxisMaxValue = 100; graph.yAxis.AxisMaxValue = 100; graph.legend.hideLegend = true; graph.xAxis.SetLabelsUsingMaxMin = true; graph.xAxis.LabelType = WMG_Axis.labelTypes.ticks; graph.autoAnimationsEnabled = true; series1 = graph.addSeries(); series1.hidePoints = true; series1.lineScale = 0.4f; if (useComputeShader) { series1.areaShadingTextureResolution = 4096; if (drawAreaShading) { series1.areaShadingType = WMG_Series.areaShadingTypes.Gradient; series1.areaShadingUsesComputeShader = true; series1.areaShadingColor = Color.blue; series1.areaShadingAxisValue = 0; } series1.linesUseComputeShader = true; series1.neverCreateLines = true; series1.neverCreatePoints = true; } else { series1.LineCreated += groupLinesInCanvases; series1.PointCreated += groupPointsInCanvases; } series1.pointValues.SetList(WMG_Util.GenRandomY(numPointsToCreate, 0, 100, 0, 100)); }
void Start() { changeObjs.Add(plottingDataC); GameObject graphGO = GameObject.Instantiate(emptyGraphPrefab) as GameObject; graphGO.transform.SetParent(this.transform, false); graph = graphGO.GetComponent <WMG_Axis_Graph>(); //graph.stretchToParent(graphGO); // 화면에 맞게 늘리기 graphOverlay = new GameObject(); graphOverlay.AddComponent <RectTransform>(); graphOverlay.name = "Graph Overlay"; graphOverlay.transform.SetParent(graphGO.transform, false); graph.autoAnimationsEnabled = false; graph.yAxis.MaxAutoGrow = true; // auto increase yAxis max if a point value exceeds max graph.yAxis.MinAutoGrow = true; // auto decrease yAxis min if a point value exceeds min //graph.xAxis.AxisNumTicks = 5; Debug.Log("graph.xAxis.AxisMaxValue : " + graph.xAxis.AxisMaxValue); Debug.Log("graph.xAxis.AxisLinePadding : " + graph.xAxis.AxisLinePadding); Debug.Log("graph.xAxis.AxisNumTicks : " + graph.xAxis.AxisNumTicks); // series1 = graph.addSeries(); //AddData(); //if (series1Data2.Count > 0) // series1.pointValues.SetList(data); Debug.Log("series1.UseXDistBetweenToSpace : " + series1.UseXDistBetweenToSpace); Debug.Log("series1.AutoUpdateXDistBetween : " + series1.AutoUpdateXDistBetween); //increment = 1f / 10f;// graph.xAxis.AxisMaxValue; plottingDataC.OnChange += PlottingDataChanged; if (plotOnStart) { plottingData = true; } }
// Use this for initialization void Start() { graphGO = GameObject.Instantiate(emptyGraphPrefab); graphGO.transform.SetParent(this.transform, false); graph = graphGO.GetComponent <WMG_Axis_Graph> (); series1 = graph.addSeries(); series1.pointValues.SetList(series1Data); //graph.xAxis.AxisMaxValue = 5; //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 = "Look at a page to get started"; // series1.UseXDistBetweenToSpace = true; // series1.pointValues.SetList(data); //} //else { // series1.pointValues.SetList(series1Data); //} }
// Use this for initialization void Start() { GameObject graphGO = GameObject.Instantiate(emptyGraphPrefab); graphGO.transform.SetParent(this.transform, false); graph = graphGO.GetComponent <WMG_Axis_Graph>(); graph.stretchToParent(graphGO); graph.xAxis.AxisMinValue = 0; graph.yAxis.AxisMinValue = 0; graph.xAxis.AxisMaxValue = 100; graph.yAxis.AxisMaxValue = 100; graph.legend.hideLegend = true; graph.xAxis.SetLabelsUsingMaxMin = true; graph.xAxis.LabelType = WMG_Axis.labelTypes.ticks; graph.autoAnimationsEnabled = true; series1 = graph.addSeries(); series1.pointColor = new Color(210 / 255f, 100 / 255f, 100 / 255f, 1); series1.PointCreated += groupPointsInCanvases; series1.neverCreateLines = true; series1.pointValues.SetList(WMG_Util.GenRandomXY(numPointsToCreate, 0, 100, 0, 100)); Canvas graphBgCanvas = graph.graphBackground.transform.parent.gameObject.AddComponent <Canvas>(); graph.graphBackground.transform.parent.gameObject.AddComponent <GraphicRaycaster>(); graphBgCanvas.overrideSorting = true; graphBgCanvas.sortingOrder = 0; graph.toolTipPanel.SetActive(true); // for some reason setting canvas override sorting doesn't work for inactive gameobject, so enable and then set back to disable Canvas tooltipCanvas = graph.toolTipPanel.AddComponent <Canvas>(); // otherwise tooltip appears behind points which are on their own canvas of higher sorting order tooltipCanvas.overrideSorting = true; tooltipCanvas.sortingLayerID = 0; tooltipCanvas.sortingOrder = 2 + ((numPointsToCreate - 1) / numPointsPerCanvas); graph.toolTipPanel.SetActive(false); }
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(); }
// Use this for initialization void Start() { GameObject graphGO = GameObject.Instantiate(emptyGraphPrefab); graphGO.transform.SetParent(this.transform, false); graph = graphGO.GetComponent<WMG_Axis_Graph>(); series1 = graph.addSeries(); graph.xAxis.AxisMaxValue = 5; 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.AutoUpdateXDistBetween = true; series1.pointValues.SetList(data); } else { series1.pointValues.SetList(series1Data); } }
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(); }
// Use this for initialization void Start() { GameObject graphGO = GameObject.Instantiate(emptyGraphPrefab) as GameObject; graphGO.transform.SetParent(this.transform, false); graph = graphGO.GetComponent <WMG_Axis_Graph>(); graph.legend.hideLegend = true; graph.changeSpriteSize(graphGO, 800, 600); graph.axesType = WMG_Axis_Graph.axesTypes.CENTER; graph.yAxis.AxisMinValue = -20; graph.yAxis.AxisMaxValue = 20; graph.yAxis.AxisNumTicks = 11; graph.yAxis.numDecimalsAxisLabels = 2; // auto grow / shrink the y-axis min and max values based on series data graph.yAxis.MaxAutoGrow = true; graph.yAxis.MaxAutoShrink = true; graph.yAxis.MinAutoGrow = true; graph.yAxis.MinAutoShrink = true; graph.xAxis.AxisMinValue = -10; graph.xAxis.AxisMaxValue = 10; graph.xAxis.AxisNumTicks = 11; graph.xAxis.MaxAutoGrow = true; graph.xAxis.MaxAutoShrink = true; graph.xAxis.MinAutoGrow = true; graph.xAxis.MinAutoShrink = true; graph.xAxis.LabelType = WMG_Axis.labelTypes.ticks; graph.xAxis.SetLabelsUsingMaxMin = true; series = graph.addSeries(); series.lineScale = 0.5f; series.pointColor = Color.red; series.linePadding = 0.2f; decimalsMultiplier = Mathf.Pow(10f, numDecimalsToRound); }