Ejemplo n.º 1
0
        public void InitYAxis(int yMaxSize, float yStart, float ySegment)
        {
            YAxis.transform.localScale = new Vector3(YAxis.transform.localScale.x, YLength + ySegment,
                                                     YAxis.transform.localScale.z);
            YpointCount = ((YLength - yStart) / ySegment) + 1;
            for (int i = 0; i < YpointCount; i++)
            {
                float   distance = 1;
                Vector3 pos;
                if (i == 0)
                {
                    distance = yStart;
                    pos      = transform.localPosition + new Vector3(0, distance, 0);
                }
                else
                {
                    distance = ySegment;

                    pos = ListOfYPoints[i - 1].transform.localPosition + new Vector3(0, distance, 0);
                }

                GraphPoint temp = Instantiate(YPoint, transform.localPosition, transform.rotation);
                temp.transform.parent        = transform;
                temp.transform.localPosition = pos;

                temp.transform.localScale         = temp.transform.localScale * graphScaleFactor;
                temp.labelContainer.localPosition = new Vector3(XLength + (xOffset), 0, 0) / graphScaleFactor;
                ListOfYPoints.Add(temp);
            }
        }
Ejemplo n.º 2
0
        public void InitZAxis(int zMaxSize, float zStart, float zSegment, float zRowOffset, float xStart,
                              float xSegment)
        {
            ZAxis.transform.localScale = new Vector3(ZAxis.transform.localScale.x, ZAxis.transform.localScale.y,
                                                     ZLength + zSegment);


            if (zSegment == 0)
            {
                ZpointCount = zMaxSize;
            }
            else
            {
                ZpointCount = ((ZLength - zStart) / zSegment) + 1;
            }


            for (int i = 0; i < ZpointCount; i++)
            {
                float   distance = 1;
                Vector3 pos;
                if (i == 0)
                {
                    distance = zStart;
                    pos      = transform.localPosition + new Vector3(0, 0, -distance);
                }
                else
                {
                    distance = zSegment;

                    pos = ListOfZPoints[i - 1].transform.localPosition + new Vector3(0, 0, -distance);
                }

                GraphPoint temp = Instantiate(ZPoint, transform.position, transform.rotation);
                temp.transform.parent        = transform;
                temp.transform.localPosition = pos;


                temp.transform.localScale         = temp.transform.localScale * graphScaleFactor;
                temp.labelContainer.localPosition = temp.labelContainer.localPosition =
                    new Vector3(XLength + (1.8f * xOffset), 0, 0) / graphScaleFactor;
                ListOfZPoints.Add(temp);

                GameObject grouptemp = GameObject.Instantiate(horizontalGroup, transform.position, transform.rotation);

                grouptemp.transform.parent        = barParent.transform;
                grouptemp.transform.localPosition = pos + new Vector3((zRowOffset * i), 0, 0);

                grouptemp.GetComponent <RectTransform>().sizeDelta            = new Vector2(XLength, YLength);
                grouptemp.GetComponent <HorizontalLayoutGroup>().padding.left = (int)xStart;
                grouptemp.GetComponent <HorizontalLayoutGroup>().spacing      = (int)xSegment;
                grouptemp.transform.localScale = Vector3.one;
                ListOfGroups.Add(grouptemp.GetComponent <BarGorup>());
                // Debug.Log("count incremented =======" + ListOfGroups.Count);
            }
        }
Ejemplo n.º 3
0
        public void InitYAxis(int yMaxSize, float yStart, float ySegment)
        {
            foreach (var p in ListOfYPoints)
            {
                if (p != null)
                {
                    DestroyImmediate(p.gameObj);
                    DestroyImmediate(p);
                }
            }

            ListOfYPoints.Clear();

            YAxis.transform.localScale = new Vector3(YAxis.transform.localScale.x, YLength + ySegment, YAxis.transform.localScale.z);
            YpointCount = ((YLength - yStart) / ySegment) + 1;
            for (int i = 0; i < YpointCount; i++)
            {
                float   distance = 1;
                Vector3 pos;
                if (i == 0)
                {
                    distance = yStart;
                    pos      = transform.localPosition + new Vector3(0, distance, 0);
                }
                else
                {
                    distance = ySegment;

                    pos = ListOfYPoints[i - 1].transform.localPosition + new Vector3(0, distance, 0);
                }

                if (YPoint == null)
                {
                    GameObject p = Resources.Load(@"YPoint") as GameObject;
                    YPoint         = p.GetComponent <GraphPoint>();
                    YPoint.gameObj = p;
                }

                GraphPoint temp = Instantiate(YPoint, transform.localPosition, transform.rotation);
                temp.transform.parent        = transform;
                temp.transform.localPosition = pos;

                temp.transform.localScale         = temp.transform.localScale * graphScaleFactor;
                temp.labelContainer.localPosition = new Vector3(XLength + (1.8f * xOffset), 0, 0) / graphScaleFactor;
                ListOfYPoints.Add(temp);
            }
        }
Ejemplo n.º 4
0
        public void InitXAxis(int xMaxSize, float xStart, float xSegment, float xRowOffset)
        {
            XAxis.transform.localScale = new Vector3(XLength + xSegment, XAxis.transform.localScale.y,
                                                     XAxis.transform.localScale.z);

            if (xSegment == 0)
            {
                XpointCount = xMaxSize;
            }
            else
            {
                XpointCount = ((XLength - xStart) / xSegment) + 1;
            }

            for (int i = 0; i < XpointCount; i++)
            {
                float   distance = 1;
                Vector3 pos;

                if (i == 0)
                {
                    distance = xStart;
                    pos      = transform.localPosition + new Vector3(distance, 0, 0);
                }
                else
                {
                    distance = xSegment;
                    pos      = ListOfXPoint[i - 1].transform.localPosition + new Vector3(distance, 0, 0);
                }


                GraphPoint temp = Instantiate(XPoint, transform.position, transform.rotation);


                temp.transform.parent        = transform;
                temp.transform.localPosition = pos;

                temp.transform.localScale         = temp.transform.localScale * graphScaleFactor;
                temp.labelContainer.localPosition = new Vector3(0, 0, -(ZLength + (1.8f * zOffset))) / graphScaleFactor;

                ListOfXPoint.Add(temp);
            }
        }
Ejemplo n.º 5
0
        public void InitXAxis(int xMaxSize, float xStart, float xSegment, float xRowOffset)
        {
            foreach (var p in ListOfXPoint)
            {
                if (p != null)
                {
                    DestroyImmediate(p.gameObj);
                    DestroyImmediate(p);
                }
            }

            ListOfXPoint.Clear();

            XAxis.transform.localScale = new Vector3(XLength + xSegment, XAxis.transform.localScale.y, XAxis.transform.localScale.z);

            if (xSegment == 0)
            {
                XpointCount = xMaxSize;
            }
            else
            {
                XpointCount = ((XLength - xStart) / xSegment) + 1;
            }

            for (int i = 0; i < XpointCount; i++)
            {
                float   distance = 1;
                Vector3 pos;

                if (i == 0)
                {
                    distance = xStart;
                    pos      = transform.localPosition + new Vector3(distance, 0, 0);
                }
                else
                {
                    distance = xSegment;
                    pos      = ListOfXPoint[i - 1].transform.localPosition + new Vector3(distance, 0, 0);
                }



                if (XPoint == null)
                {
                    GameObject p = Resources.Load(@"XPoint") as GameObject;
                    XPoint         = p.GetComponent <GraphPoint>();
                    XPoint.gameObj = p;
                }

                GraphPoint temp = Instantiate(XPoint, transform.position, transform.rotation);


                temp.transform.parent        = transform;
                temp.transform.localPosition = pos;

                temp.transform.localScale         = temp.transform.localScale * graphScaleFactor;
                temp.labelContainer.localPosition = new Vector3(0, 0, -(ZLength + (1.8f * zOffset))) / graphScaleFactor;

                ListOfXPoint.Add(temp);
            }
        }