Example #1
0
            public override void UpdateMarker(int index)
            {
                base.UpdateMarker(index);

                // Get first chart line component
                ChartLine chartLine = FindObjectOfType <ChartLine>();

                // Get first line renderer component
                LineRenderer lineRenderer = chartLine.GetComponent <LineRenderer>();

                // Get marker position
                Vector3 markerPosition = lineRenderer.GetPosition(index);

                // Set marker object position
                this.gameObject.transform.localPosition = new Vector3(
                    markerPosition.x, 0, this.gameObject.transform.localPosition.z);

                // Get max and min values for all the chart lines and the given index
                List <float> yValueSet = new List <float>();

                foreach (ChartLine cl in FindObjectsOfType <ChartLine>())
                {
                    yValueSet.Add(cl.Y[index]);
                }
                String minText = yValueSet.Min().ToString("0.00#");
                String maxText = yValueSet.Max().ToString("0.00#");

                // Set text label
                this.gameObject.transform.GetComponentInChildren <TextMesh>().text = "Min: " + minText + " Max: " + maxText;
            }
Example #2
0
            public override void UpdateMarker(int index)
            {
                base.UpdateMarker(index);

                // Get chart line component
                ChartLine chartLine = FindObjectOfType <ChartLine>();

                // Get line renderer component
                LineRenderer lineRenderer = chartLine.GetComponent <LineRenderer>();

                // Get marker point position
                Vector3 markerPosition = lineRenderer.GetPosition(index);

                // Set marker position
                this.gameObject.transform.localPosition = new Vector3(
                    markerPosition.x, markerPosition.y, this.gameObject.transform.localPosition.z);

                // Define marker line component
                this.gameObject.transform.Find("Line").GetComponent <LineRenderer>().SetPosition(0, new Vector3(0, -markerPosition.y - 2.2f));

                // Define marker text
                this.gameObject.transform.GetComponentInChildren <TextMesh>().text = chartLine.GetComponent <ChartLine>().Y[index].ToString("0.00#");
            }