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.useGroups = true; graph.xAxis.LabelType = WMG_Axis.labelTypes.groups; graph.xAxis.AxisNumTicks = 13; graph.xAxis.AxisLabelRotation = 45; graph.legend.hideLegend = true; graph.legend.background.SetActive(false); graph.yAxis.hideGrid = true; graph.xAxis.hideGrid = true; graph.InEditorUpdate(); createPrefab(graphGO, axisGraphLocation + "BarGraph.prefab"); DestroyImmediate(graphGO); }
static void createAreaGraph() { GameObject graphGO = GameObject.Instantiate(baseAxis) as GameObject; WMG_Axis_Graph graph = graphGO.GetComponent <WMG_Axis_Graph>(); graph.changeSpriteParent(graphGO, theCanvas); graphGO.name = "AreaShadingGraph"; graph.changeSpriteSize(graphGO, 525, 325); graph.changeSpritePositionTo(graphGO, new Vector3(-190.2f, 180.2f, 0)); graph.paddingTopBottom = new Vector2(graph.paddingTopBottom.x, 60); graph.legend.hideLegend = true; graph.legend.background.SetActive(false); DestroyImmediate(graph.lineSeries[1]); graph.lineSeries.RemoveAt(1); graph.yAxis.AxisMinValue = -5; graph.yAxis.AxisNumTicks = 6; graph.autoAnimationsEnabled = false; WMG_Series series = graph.lineSeries[0].GetComponent <WMG_Series>(); series.areaShadingType = WMG_Series.areaShadingTypes.Gradient; series.areaShadingColor = new Color32(0, 20, 150, 255); series.areaShadingAxisValue = -2; series.areaShadingUsesComputeShader = true; graph.yAxis.hideGrid = true; graph.xAxis.hideGrid = true; graph.InEditorUpdate(); createPrefab(graphGO, axisGraphLocation + "AreaShadingGraph.prefab"); DestroyImmediate(graphGO); }
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); }
static void createScatterPlot() { GameObject graphGO = GameObject.Instantiate(baseAxis) as GameObject; WMG_Axis_Graph graph = graphGO.GetComponent <WMG_Axis_Graph>(); graph.changeSpriteParent(graphGO, theCanvas); graphGO.name = "ScatterPlot"; 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.xAxis.SetLabelsUsingMaxMin = true; graph.xAxis.LabelType = WMG_Axis.labelTypes.ticks; WMG_Series series1 = graph.lineSeries[0].GetComponent <WMG_Series>(); if (series1 == null) { return; } series1.UseXDistBetweenToSpace = false; series1.hideLines = true; series1.pointWidthHeight = 5; List <Vector2> s1Data = new List <Vector2>(); s1Data.Add(new Vector2(1, 19)); s1Data.Add(new Vector2(3, 20)); s1Data.Add(new Vector2(3, 16)); s1Data.Add(new Vector2(5, 18)); s1Data.Add(new Vector2(6, 13)); s1Data.Add(new Vector2(7, 12)); s1Data.Add(new Vector2(8, 14)); s1Data.Add(new Vector2(13, 8)); s1Data.Add(new Vector2(16, 7)); s1Data.Add(new Vector2(18, 6)); s1Data.Add(new Vector2(21, 5.6f)); s1Data.Add(new Vector2(24, 5)); s1Data.Add(new Vector2(27, 4.5f)); s1Data.Add(new Vector2(38, 3.5f)); s1Data.Add(new Vector2(45, 3)); s1Data.Add(new Vector2(55, 2.5f)); s1Data.Add(new Vector2(65, 2)); s1Data.Add(new Vector2(75, 2.3f)); s1Data.Add(new Vector2(80, 2)); s1Data.Add(new Vector2(85, 1.6f)); s1Data.Add(new Vector2(88, 1)); s1Data.Add(new Vector2(91, 1.5f)); s1Data.Add(new Vector2(93, 2)); s1Data.Add(new Vector2(95, 1.3f)); s1Data.Add(new Vector2(99, 1)); series1.pointValues.SetList(s1Data); series1.pointValuesListChanged(false, true, false, -1); series1.pointColor = new Color32(65, 255, 0, 255); WMG_Series series2 = graph.lineSeries[1].GetComponent <WMG_Series>(); if (series2 == null) { return; } series2.UseXDistBetweenToSpace = false; series2.hidePoints = true; series2.lineScale = 1; List <Vector2> s2Data = new List <Vector2>(); s2Data.Add(new Vector2(2, 19)); s2Data.Add(new Vector2(12, 7)); s2Data.Add(new Vector2(45, 2.5f)); s2Data.Add(new Vector2(95, 1.7f)); series2.pointValues.SetList(s2Data); series2.pointValuesListChanged(false, true, false, -1); series2.pointPrefab = 0; series2.linkPrefab = 1; series2.lineColor = new Color32(0, 190, 255, 145); series2.pointColor = new Color32(0, 190, 255, 255); graph.yAxis.hideGrid = true; graph.xAxis.hideGrid = true; graph.InEditorUpdate(); createPrefab(graphGO, axisGraphLocation + "ScatterPlot.prefab"); DestroyImmediate(graphGO); }
static void createStackedGraph() { GameObject graphGO = GameObject.Instantiate(baseAxis) as GameObject; WMG_Axis_Graph graph = graphGO.GetComponent <WMG_Axis_Graph>(); graph.changeSpriteParent(graphGO, theCanvas); graphGO.name = "StackedLineGraph"; graph.changeSpriteSize(graphGO, 525, 325); graph.changeSpritePositionTo(graphGO, new Vector3(210.2f, -155.2f, 0)); graph.paddingTopBottom = new Vector2(graph.paddingTopBottom.x, 60); graph.legend.hideLegend = true; graph.legend.background.SetActive(false); graph.yAxis.AxisMinValue = -5; graph.yAxis.AxisNumTicks = 6; graph.autoAnimationsEnabled = false; WMG_Series series = graph.lineSeries[0].GetComponent <WMG_Series>(); series.areaShadingType = WMG_Series.areaShadingTypes.Solid; series.areaShadingColor = new Color32(0, 20, 150, 255); series.areaShadingAxisValue = -4.75f; series.areaShadingUsesComputeShader = true; List <Vector2> s1Data = new List <Vector2>(); s1Data.Add(new Vector2(0, 0.5f)); s1Data.Add(new Vector2(0, 1)); s1Data.Add(new Vector2(0, 1.5f)); s1Data.Add(new Vector2(0, 3)); s1Data.Add(new Vector2(0, 4)); s1Data.Add(new Vector2(0, 6)); s1Data.Add(new Vector2(0, 9)); s1Data.Add(new Vector2(0, 14)); s1Data.Add(new Vector2(0, 15)); s1Data.Add(new Vector2(0, 17)); s1Data.Add(new Vector2(0, 19)); s1Data.Add(new Vector2(0, 20)); series.pointValues.SetList(s1Data); series.pointValuesListChanged(false, true, false, -1); series.extraXSpace = 2; WMG_Series series2 = graph.lineSeries[1].GetComponent <WMG_Series>(); series2.areaShadingType = WMG_Series.areaShadingTypes.Solid; series2.areaShadingColor = new Color32(0, 125, 15, 255); series2.areaShadingAxisValue = -4.75f; List <Vector2> s2Data = new List <Vector2>(); s2Data.Add(new Vector2(0, -3)); s2Data.Add(new Vector2(0, -2)); s2Data.Add(new Vector2(0, -3)); s2Data.Add(new Vector2(0, -2)); s2Data.Add(new Vector2(0, 0)); s2Data.Add(new Vector2(0, 1)); s2Data.Add(new Vector2(0, 2)); s2Data.Add(new Vector2(0, 4)); s2Data.Add(new Vector2(0, 8)); s2Data.Add(new Vector2(0, 6)); s2Data.Add(new Vector2(0, 7)); s2Data.Add(new Vector2(0, 4)); series2.pointValues.SetList(s2Data); series2.pointValuesListChanged(false, true, false, -1); series2.extraXSpace = 2; series2.pointColor = new Color32(255, 120, 0, 255); series2.areaShadingUsesComputeShader = true; graph.yAxis.hideGrid = true; graph.xAxis.hideGrid = true; graph.InEditorUpdate(); createPrefab(graphGO, axisGraphLocation + "StackedLineGraph.prefab"); DestroyImmediate(graphGO); }
void UpdateSceneView() { graph.InEditorUpdate(); }