public void Init() { graph = (WMG_Axis_Graph)target; fields = GetProperties(graph); yAxisSO = new SerializedObject(serializedObject.FindProperty("yAxis").objectReferenceValue); xAxisSO = new SerializedObject(serializedObject.FindProperty("xAxis").objectReferenceValue); yAxisfields = GetProperties(graph.yAxis); xAxisfields = GetProperties(graph.xAxis); }
// 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; } }
void UpdateIndicatorSize(WMG_Axis_Graph aGraph) { aGraph.changeSpritePositionTo(graphOverlay, aGraph.graphBackground.transform.parent.transform.localPosition); float indicatorWidth = (aGraph.getSpriteWidth(aGraph.graphBackground) - aGraph.paddingLeftRight[0] - aGraph.paddingLeftRight[1]); aGraph.changeSpriteSize(indicatorGO, Mathf.RoundToInt(indicatorWidth), 2); aGraph.changeSpritePositionToX(indicatorGO, indicatorWidth / 2f); //updateIndicator(); }
// 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()
// 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); }
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() { T3FS = GameObject.FindObjectOfType <Top3FeelingsScript>(); GICS = GameObject.FindObjectOfType <GraphInfoControllerScript>(); table = new Dictionary <int, float>(); feelingCountsTable = new Dictionary <string, int>(); graph = newGraph.GetComponent <WMG_Axis_Graph>(); try { if (useRandomData) { saveDataContainer = SaveDataContainer.LoadFromText(randomData.text); } else { saveDataContainer = SaveDataContainer.Load(Application.persistentDataPath + "/SaveDataContainer.xml"); } feelings = saveDataContainer.SaveDataArray; } catch (Exception e) { Debug.Log("SaveData load failed"); } currentWeek = GetWeekValue(feelings[feelings.GetLength(0) - 1].date); currentMonth = GetMonthValue(feelings[feelings.GetLength(0) - 1].date); currentYear = feelings[feelings.GetLength(0) - 1].date.Year; //if (feelings.GetLength(0) == 0) return; //date = feelings[0].date; //currentDateValue = 0; //for (int i = 0; i < feelings.GetLength(0); i++) //{ // if (i == feelings.GetLength(0) - 1) // { // currentDateValue += (int)feelings[i].feeling.type; // table.Add(GetDateValue(feelings[i].date), currentDateValue); // break; // } // if (GetDateValue(feelings[i].date) == date.DayOfYear) // { // currentDateValue += (int)feelings[i].feeling.type; // continue; // } // if(currentDateValue==0) currentDateValue = (int)feelings[i].feeling.type; // Debug.Log("Table length: " + table.Count); // table.Add(GetDateValue(date), currentDateValue); // Debug.Log("tallennettava: " + feelings[i].date.DayOfYear); // date = feelings[i].date; // currentDateValue = 0; //} //CreateGraph(); CreateGraphWeek(); }
// create graph gameobject, save Axis Graph and add world space and series void InitializeGraph() { GameObject graphGO = base.InstantiateGraph(); graph = graphGO.GetComponent <WMG_Axis_Graph>(); graph.Init(); AddWorldSpaceScript(); AddGraphSeries(); yLabels = GetLabels('y'); }
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; }
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); }
// 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 Start() { TopPlotPanel = GameObject.Find("TopPlotPanel"); BottomPlotPanel = GameObject.Find("BottomPlotPanel"); TopPostPlotPanel = GameObject.Find("TopPostPlotPanel"); TopPostPlotPanel.SetActive(false); BottomPostPlotPanel = GameObject.Find("BottomPostPlotPanel"); BottomPostPlotPanel.SetActive(false); StartButton = GameObject.Find("StartButton"); StopButton = GameObject.Find("StopButton"); SaveDataButton = GameObject.Find("SaveButton"); NewSessionButton = GameObject.Find("NewSessionButton"); SessionDateLabel = GameObject.Find("SessionTimeLabel"); NewSessionButton.SetActive(false); PlayPostButton = GameObject.Find("PlayPostButton"); PausePostButton = GameObject.Find("PausePostButton"); StopPostButton = GameObject.Find("StopPostButton"); CheckNodesButton = GameObject.Find("CheckButton"); PlayPostButton.SetActive(false); PausePostButton.SetActive(false); StopPostButton.SetActive(false); graphGO = Instantiate(graphPrefab) as GameObject; graphGOBottom = Instantiate(graphPrefabBottom) as GameObject; graph = graphGO.GetComponent <WMG_Axis_Graph>(); graphBottom = graphGOBottom.GetComponent <WMG_Axis_Graph>(); graph.changeSpriteParent(graphGO, TopPlotPanel); graphBottom.changeSpriteParent(graphGOBottom, BottomPlotPanel); graph.lineSeries[0].GetComponent <WMG_Series>().hideLines = true; graph.lineSeries[0].GetComponent <WMG_Series>().hidePoints = true; graph.lineSeries[1].GetComponent <WMG_Series>().hideLines = true; graph.lineSeries[1].GetComponent <WMG_Series>().hidePoints = true; graphBottom.lineSeries[0].GetComponent <WMG_Series>().hideLines = true; graphBottom.lineSeries[0].GetComponent <WMG_Series>().hidePoints = true; graphBottom.lineSeries[1].GetComponent <WMG_Series>().hideLines = true; graphBottom.lineSeries[1].GetComponent <WMG_Series>().hidePoints = true; PopulateLists(); InitializeDropdowns(); play_bool = false; post_plotting = false; already_played = false; UpdateFrame = PhysioThread.BodyMoveUpdateFrame; current_time = 0; delta_time = 0; }
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() { if (hasInit) return; hasInit = true; pieGraph = theGraph.GetComponent<WMG_Pie_Graph>(); axisGraph = theGraph.GetComponent<WMG_Axis_Graph>(); changeObjs.Add(legendC); setOriginalPropertyValues(); legendC.OnChange += LegendChanged; PauseCallbacks(); }
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 Start() { chosenSpot = Field.Spots[0, 0];//startverdi [0,0] i muldteig muldTeig = Farm.muldTeig; //bare ett jordstykke i oppgaven. muldteig GameObject graphGO = GameObject.Instantiate(emptyGraphPrefab); graphGO.transform.SetParent(this.transform, false); graph = graphGO.GetComponent<WMG_Axis_Graph>(); notfirsttime = false; thisSpot = Initializer.SpotValgt; InitierGraf(); }//start()
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(); }
public void StartPlotting() { Destroy(graphGO); Destroy(graphGOBottom); graphGO = Instantiate(graphPrefab) as GameObject; graphGOBottom = Instantiate(graphPrefabBottom) as GameObject; graph = graphGO.GetComponent <WMG_Axis_Graph>(); graphBottom = graphGOBottom.GetComponent <WMG_Axis_Graph>(); graph.changeSpriteParent(graphGO, TopPlotPanel); graphBottom.changeSpriteParent(graphGOBottom, BottomPlotPanel); StartCoroutine(realTimePlot()); }
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); } }
static void createBarGraph() { GameObject graphGO = GameObject.Instantiate(baseAxis) as GameObject; WMG_Axis_Graph graph = graphGO.GetComponent <WMG_Axis_Graph>(); graph.changeSpriteParent(graphGO, theCanvas); graphGO.name = "BarGraph"; graph.graphType = WMG_Axis_Graph.graphTypes.bar_side; graph.changeSpriteSize(graphGO, 405, 280); graph.changeSpritePositionTo(graphGO, new Vector3(-250, 180, 0)); graph.paddingTopBottom = new Vector2(graph.paddingTopBottom.x, 60); graph.legend.hideLegend = true; graph.legend.background.SetActive(false); graph.yAxis.hideGrid = true; graph.xAxis.hideGrid = true; }
void Start() { GameObject graphGO = GameObject.Instantiate(graphPrefab) as GameObject; graph = graphGO.GetComponent<WMG_Axis_Graph>(); graph.changeSpriteParent(graphGO, this.gameObject); graph.changeSpritePositionTo(graphGO, Vector3.zero); graph.graphTitleOffset = new Vector2(0, 60); graph.autoAnimationsDuration = testInterval - 0.1f; waitTime = new WaitForSeconds(testInterval); animDuration = testInterval - 0.1f; // have animations slightly faster than the test interval if (animDuration < 0) animDuration = 0; if (performTests) { StartCoroutine(startTests()); } }
// Use this for initialization void Awake() { todayUsePowerAmount = transform.Find("todayUsePowerAmount").GetComponent <Text>(); nowLoad = transform.Find("nowLoad").GetComponent <Text>(); todayPowerMoney = transform.Find("todayPowerMoney").GetComponent <Text>(); barGraph = transform.Find("LineGraphPower").GetComponent <WMG_Axis_Graph>(); receiveData.PowerSys("powerDistriSystem"); for (int i = 2; i <= 95; i += 4) { int a = int.Parse(receiveData.powerData[i]); totalTime.Add(a); } Hello(); GetData(); dataLabelsParent = transform.Find("LineGraphPower/Series/Series1/dataLabelsParent"); Invoke("CompareValues", 1f); }
static void createEmptyGraph() { GameObject graphGO = GameObject.Instantiate(baseAxis) as GameObject; WMG_Axis_Graph graph = graphGO.GetComponent <WMG_Axis_Graph>(); graph.changeSpriteParent(graphGO, theCanvas); graphGO.name = "EmptyGraph"; graph.changeSpritePositionTo(graphGO, Vector3.zero); for (int i = graph.lineSeries.Count - 1; i >= 0; i--) { graph.deleteSeriesAt(i); } graph.InEditorUpdate(); createPrefab(graphGO, axisGraphLocation + "EmptyGraph.prefab"); DestroyImmediate(graphGO); }
public void Init() { graph = (WMG_Axis_Graph)target; fields = GetProperties(graph); yAxisSO = new SerializedObject(serializedObject.FindProperty("yAxis").objectReferenceValue); nullYaxis2 = serializedObject.FindProperty("yAxis2").objectReferenceValue == null; if (!nullYaxis2) { yAxis2SO = new SerializedObject(serializedObject.FindProperty("yAxis2").objectReferenceValue); } xAxisSO = new SerializedObject(serializedObject.FindProperty("xAxis").objectReferenceValue); yAxisfields = GetProperties(graph.yAxis); if (!nullYaxis2) { yAxis2fields = GetProperties(graph.yAxis2); } xAxisfields = GetProperties(graph.xAxis); }
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; }
// 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)); }
// Use this for initialization void Start() { WMG_Axis_Graph test = GetComponent <WMG_Axis_Graph> (); DateTime dtObj = DateTime.Now; //以 月份 日, 年 的格式輸出 string yesterday = dtObj.AddDays(-1).ToString("MM/dd", new CultureInfo("en-US")); string two = dtObj.AddDays(-2).ToString("MM/dd", new CultureInfo("en-US")); string three = dtObj.AddDays(-3).ToString("MM/dd", new CultureInfo("en-US")); string four = dtObj.AddDays(-4).ToString("MM/dd", new CultureInfo("en-US")); string five = dtObj.AddDays(-5).ToString("MM/dd", new CultureInfo("en-US")); //結果為 March 11, 2010 test.xAxisLabels[0] = four; test.xAxisLabels[1] = three; test.xAxisLabels[2] = two; test.xAxisLabels[3] = yesterday; test.xAxisLabels[4] = "今日"; }
static void createBarGraph() { GameObject graphGO = GameObject.Instantiate(baseAxis) as GameObject; WMG_Axis_Graph graph = graphGO.GetComponent <WMG_Axis_Graph>(); graph.changeSpriteParent(graphGO, theCanvas); graphGO.name = "BarGraph"; graph.graphType = WMG_Axis_Graph.graphTypes.bar_side; graph.changeSpriteSize(graphGO, 405, 280); graph.changeSpritePositionTo(graphGO, new Vector3(-250, 180, 0)); graph.paddingTopBottom = new Vector2(graph.paddingTopBottom.x, 60); Object newLegend = AssetDatabase.LoadAssetAtPath("Assets/Graph_Maker/Prefabs/Misc/Legend-None.prefab", typeof(GameObject)); if (newLegend != null) { graph.legendPrefab = newLegend; } graph.hideYGrid = true; graph.hideXGrid = true; }
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>(); 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 Start() { GameObject graphGO = GameObject.Instantiate(graphPrefab) as GameObject; graph = graphGO.GetComponent<WMG_Axis_Graph>(); graph.changeSpriteParent(graphGO, this.gameObject); graph.changeSpritePositionTo(graphGO, Vector3.zero); graph.graphTitleOffset = new Vector2(0, 60); graph.autoAnimationsDuration = testInterval - 0.1f; newSeries = new List<Vector2>(); counter = 0; waitTime = new WaitForSeconds(testInterval); animDuration = testInterval - 0.1f; // have animations slightly faster than the test interval if (animDuration < 0) animDuration = 0; WMG_Data_Source dataSource = graph.lineSeries[0].GetComponent<WMG_Series>().pointValuesDataSource; if (dataSource != null) { dataSource.setDataProvider(dataProvider); } if (performTests) { StartCoroutine(startTests()); } //gameObject. }
void OnEnable() { // myTarget = new SerializedObject(target); graph = (WMG_Axis_Graph)target; }
internal void SetMonthLabels(WMG_Axis_Graph graph) { List<string> monthLabels; if (monthIndex == 0) monthLabels = new List<string> { months[10], months[11], months[0], months[1] }; else if (monthIndex == 1) monthLabels = new List<string> { months[11], months[0], months[1], months[2] }; else if (monthIndex == 11) monthLabels = new List<string> { months[monthIndex - 2], months[monthIndex - 1], months[monthIndex], months[0] }; else monthLabels = new List<string> { months[monthIndex - 2], months[monthIndex - 1], months[monthIndex], months[monthIndex + 1] }; graph.xAxis.axisLabels.SetList(monthLabels); }
void UpdateIndicatorSize(WMG_Axis_Graph aGraph) { aGraph.changeSpritePositionTo(graphOverlay, aGraph.graphBackground.transform.parent.transform.localPosition); float indicatorWidth = (aGraph.getSpriteWidth(aGraph.graphBackground) - aGraph.paddingLeftRight[0] - aGraph.paddingLeftRight[1]); aGraph.changeSpriteSize(indicatorGO, Mathf.RoundToInt(indicatorWidth), 2); aGraph.changeSpritePositionToX(indicatorGO, indicatorWidth/2f); //updateIndicator(); }
static void copyFromAxisToRadar(ref WMG_Radar_Graph radar, WMG_Axis_Graph axis) { // lists // radar.groups.SetList(axis.groups.list); // radar.yAxisLabels.SetList(axis.yAxisLabels.list); // radar.xAxisLabels.SetList(axis.xAxisLabels.list); radar.xAxis = axis.xAxis; radar.yAxis = axis.yAxis; // Public variables without change tracking radar.tooltipOffset = axis.tooltipOffset; radar.tooltipNumberDecimals = axis.tooltipNumberDecimals; radar.tooltipDisplaySeriesName = axis.tooltipDisplaySeriesName; radar.tooltipAnimationsEnabled = axis.tooltipAnimationsEnabled; radar.tooltipAnimationsEasetype = axis.tooltipAnimationsEasetype; radar.tooltipAnimationsDuration = axis.tooltipAnimationsDuration; radar.autoAnimationsEasetype = axis.autoAnimationsEasetype; radar.autoAnimationsDuration = axis.autoAnimationsDuration; radar.lineSeries = axis.lineSeries; radar.pointPrefabs = axis.pointPrefabs; radar.linkPrefabs = axis.linkPrefabs; radar.barPrefab = axis.barPrefab; radar.seriesPrefab = axis.seriesPrefab; radar.legend = axis.legend; radar.graphTitle = axis.graphTitle; radar.graphBackground = axis.graphBackground; radar.anchoredParent = axis.anchoredParent; radar.yAxis = axis.yAxis; radar.xAxis = axis.xAxis; radar.seriesParent = axis.seriesParent; radar.toolTipPanel = axis.toolTipPanel; radar.toolTipLabel = axis.toolTipLabel; // Private backing variables radar.graphType = axis.graphType; radar.orientationType = axis.orientationType; radar.axesType = axis.axesType; radar.resizeEnabled = axis.resizeEnabled; radar.resizeProperties = axis.resizeProperties; radar.useGroups = axis.useGroups; radar.paddingLeftRight = axis.paddingLeftRight; radar.paddingTopBottom = axis.paddingTopBottom; radar.theOrigin = axis.theOrigin; radar.barWidth = axis.barWidth; radar.barAxisValue = axis.barAxisValue; radar.autoUpdateOrigin = axis.autoUpdateOrigin; radar.autoUpdateBarWidth = axis.autoUpdateBarWidth; radar.autoUpdateBarWidthSpacing = axis.autoUpdateBarWidthSpacing; radar.autoUpdateSeriesAxisSpacing = axis.autoUpdateSeriesAxisSpacing; radar.autoUpdateBarAxisValue = axis.autoUpdateBarAxisValue; radar.axisWidth = axis.axisWidth; radar.autoShrinkAtPercent = axis.autoShrinkAtPercent; radar.autoGrowAndShrinkByPercent = axis.autoGrowAndShrinkByPercent; radar.tooltipEnabled = axis.tooltipEnabled; radar.autoAnimationsEnabled = axis.autoAnimationsEnabled; radar.autoFitLabels = axis.autoFitLabels; radar.autoFitPadding = axis.autoFitPadding; radar.tickSize = axis.tickSize; radar.graphTitleString = axis.graphTitleString; radar.graphTitleOffset = axis.graphTitleOffset; }