Exemplo n.º 1
0
        private void UpdateBackgroundInstances(int requiredCount)
        {
            int currentCount = lineBackgrounds.Count;

            // Add missing backgrounds
            int missingCount = requiredCount - currentCount;

            while (missingCount > 0)
            {
                LineChartBackground chartBackground = CreateLineBackground();
                chartBackground.transform.SetSiblingIndex(0);
                lineBackgrounds.Add(chartBackground);
                missingCount--;
            }

            // Remove redundant backgrounds
            int redundantCount = currentCount - requiredCount;

            while (redundantCount > 0)
            {
                LineChartBackground target = lineBackgrounds[lineBackgrounds.Count - 1];
                DestroyImmediate(target.gameObject);
                lineBackgrounds.Remove(target);
                redundantCount--;
            }
        }
Exemplo n.º 2
0
        private LineChartBackground CreateLineBackground()
        {
            LineChartBackground lineBackground = viewCreator.InstantiateLineBackground("LineBackground",
                                                                                       chartDataContainerView.transform, PivotValue.BOTTOM_LEFT);

            lineBackground.GetComponent <RectTransform> ().sizeDelta = GetSize();
            return(lineBackground);
        }
Exemplo n.º 3
0
        public LineChartBackground InstantiateLineBackground(string name, Transform parent, Vector2 pivot)
        {
            LineChartBackground renderer = CreateBaseGameObject(name, parent, pivot)
                                           .AddComponent <LineChartBackground> ();

            renderer.raycastTarget = false;

            return(renderer);
        }
Exemplo n.º 4
0
        private void DrawLineBackground(LineChartBackground lineBackground, LineDataSet dataSet, int dataSetIndex)
        {
            lineBackground.color      = dataSet.FillColor;
            lineBackground.Texture    = dataSet.FillTexture;
            lineBackground.AxisBounds = GetAxisBounds();

            lineBackground.Points = dataSet.UseBezier ?
                                    CalculateBezierSegmentsPoints(bezierPoints[dataSetIndex]) :
                                    entriesPoints[dataSetIndex];
        }