public void DrawChart_Single(string CLOSE_VALUES_NORMALIZED, string Y_AXIS_LABELS_CLOSE_RAW, string X_AXIS_LABEL, string X_AXIS_LABEL_POS, string PREVIOUSDAY_CLOSE_NORM) { if (gameObject.activeSelf == false) { gameObject.SetActive(true); } if (LineMask.GetComponent <Animation>().isPlaying) { LineMask.GetComponent <Animation>().Stop(); } ////////////////////////////////////////////////////////////////////////////// //Single Chart Specific ////////////////////////////////////////////////////////////////////////////// ClearGraph(); LineRenderer LR; float PDC_Value; PDC_Object.SetActive(true); Graph_Dot.SetActive(true); Line_Single.SetActive(true); PaddingTop = 0.0f; PaddingSides = 0.0f; ////////////////////////////////////////////////////////////////////////////// //Setup the Graph ////////////////////////////////////////////////////////////////////////////// SetupGraph(PaddingTop, PaddingSides); ////////////////////////////////////////////////////////////////////////////// //Drawing the line ////////////////////////////////////////////////////////////////////////////// string[] graphPoints = CLOSE_VALUES_NORMALIZED.Split(';'); float pxSpacing = 1000.0f / graphPoints.Length; LR = Line_Single.GetComponent <LineRenderer>(); PDC_Value = float.Parse(PREVIOUSDAY_CLOSE_NORM) * yScale; PDC_Object.GetComponent <Transform>().localPosition = new Vector3((-PaddingSides * xScale), PDC_Value, -0.03f); PDC_Object.GetComponent <Transform>().localScale = new Vector3((1000.0f + (PaddingSides * 2.0f)) * xScale, 1.0f, 0.1f); Line_Single.GetComponent <Renderer>().material.SetFloat("_PDC_Line", PDC_Object.transform.position.y); Vector3[] positions = new Vector3[graphPoints.Length]; int posCount = 0; for (int i = 0; i < graphPoints.Length; i++) { if (graphPoints[i] != "") { posCount++; positions[i] = new Vector3((((pxSpacing) + (pxSpacing / (graphPoints.Length - 1))) * i) * xScale, float.Parse(graphPoints[i]) * yScale, 0.0f); Graph_Dot.transform.localPosition = new Vector3((((pxSpacing) + (pxSpacing / (graphPoints.Length - 1))) * i) * xScale, float.Parse(graphPoints[i]) * yScale, -0.05f); } } LR.positionCount = posCount; LR.SetPositions(positions); LR.Simplify(0.15f); ////////////////////////////////////////////////////////////////////////////// //Displaying the Y-Axis ////////////////////////////////////////////////////////////////////////////// foreach (Transform child in transform.GetComponentsInChildren <Transform>()) { if (child.gameObject.tag == "Graph_LabelY") { Destroy(child.gameObject); } } string[] yLabels = Y_AXIS_LABELS_CLOSE_RAW.Split(';'); float pySpacing = 1000.0f / yLabels.Length; for (int i = 0; i < yLabels.Length; i++) { GameObject instaY = Instantiate(Y_Label, this.GetComponent <Transform>()); instaY.transform.localPosition = new Vector3((((instaY.GetComponent <RectTransform>().rect.width / 2.0f) * -1.0f) * 0.1f) - yLabelOffset - (PaddingSides * xScale), (((pySpacing) + (pySpacing / (yLabels.Length - 1))) * i) * yScale, -0.01f); instaY.GetComponent <TextMeshPro>().SetText("$" + yLabels[i]); Transform GridY = instaY.transform.GetChild(0); GridY.localPosition = new Vector3((instaY.GetComponent <RectTransform>().rect.width / 2.0f) + (yLabelOffset * 10.0f), 0.0f); GridY.localScale = new Vector3((1000.0f + (PaddingSides * 2.0f)) * xScale * 10.0f, 0.2f, 1.0f); GridY.transform.GetChild(0).GetComponent <MeshRenderer>().material.color = new Color(1.0f, 1.0f, 1.0f, 0.35f); } ////////////////////////////////////////////////////////////////////////////// //Displaying the X-Axis ////////////////////////////////////////////////////////////////////////////// foreach (Transform child in transform.GetComponentsInChildren <Transform>()) { if (child.gameObject.tag == "Graph_LabelX") { Destroy(child.gameObject); } } string[] xLabels = X_AXIS_LABEL.Split(';'); string[] xLabelsPos = X_AXIS_LABEL_POS.Split(';'); for (int i = 0; i < xLabelsPos.Length; i++) { if (xLabelsPos[i] == "") { xLabelsPos[i] = "0"; } GameObject instaX = Instantiate(X_Label, this.GetComponent <Transform>()); instaX.transform.localPosition = new Vector3(float.Parse(xLabelsPos[i]) * xScale, 0.0f - xLabelOffset, -0.01f); instaX.GetComponent <TextMeshPro>().SetText(xLabels[i]); Transform GridX = instaX.transform.GetChild(0); GridX.transform.localPosition = new Vector3(0.0f, xLabelOffset * 10.0f); GridX.transform.localScale = new Vector3(0.2f, (1000.0f + PaddingTop) * yScale * 10.0f, 1.0f); GridX.transform.GetChild(0).GetComponent <MeshRenderer>().material.color = new Color(1.0f, 1.0f, 1.0f, 0.35f); //if (float.Parse(xLabelsPos[i]) < 25.0f) //{ // instaX.GetComponent<TextMeshPro>().enabled = false; //} } ////////////////////////////////////////////////////////////////////////////// //Setting up the Line Mask ////////////////////////////////////////////////////////////////////////////// LineMask.transform.localPosition = new Vector3(-PaddingSides * xScale, 0.0f, -0.06f); LineMask.transform.localScale = new Vector3(((1000.0f + (PaddingSides * 2.0f)) * xScale) + 0.1f, (1000.0f + PaddingTop) * yScale, 1.0f); LineMask.GetComponent <Animation>().Play(); }