コード例 #1
0
 private void UpdateLabel(ChartLabel label,
                          AxisLabelConfig config,
                          AxisLabelRendererExtry entry,
                          Vector2 rendererSize)
 {
     label.SetLabelColor(config.LabelColor);
     label.SetLabelTextSize(config.LabelSize);
     label.SetLabelTextAlignment(GetLabelAlignment(entry));
     label.SetLabelText(entry.Text);
     label.GetComponent <RectTransform> ().pivot = GetLabelPivot(entry);
     label.transform.localPosition = CreateLabelPositionForEntry(entry, rendererSize, config.LabelMargin);
 }
コード例 #2
0
        public PieChartValueIndicator InstantiatePieEntryValueIndicator(ChartLabel labelPrafab, string name, Transform parent, Vector2 pivot)
        {
            PieChartValueIndicator indicatorView = CreateBaseGameObject(name, parent, pivot)
                                                   .AddComponent <PieChartValueIndicator> ();

            indicatorView.labelPrafab = labelPrafab ?? Resources.Load <ChartLabel> ("prefabs/PieChartIndicatorLabelPrafab");
            indicatorView.GetComponent <RectTransform> ().sizeDelta = new Vector2(1f, 1f);
            indicatorView.GetComponent <RectTransform> ().anchorMin = new Vector2(0.5f, 0.5f);
            indicatorView.GetComponent <RectTransform> ().anchorMax = new Vector2(0.5f, 0.5f);

            return(indicatorView);
        }
コード例 #3
0
        private void InstantiateViews()
        {
            labelText = viewCreator.InstantiateWithPrefab <ChartLabel> (labelPrafab, transform);
            labelText.GetComponent <RectTransform> ().anchorMin = new Vector2(0.5f, 0.5f);
            labelText.GetComponent <RectTransform> ().anchorMax = new Vector2(0.5f, 0.5f);
            labelText.GetComponent <RectTransform> ().sizeDelta = new Vector2(300f, 40f);

            lineRenderer = viewCreator.InstantiateLineRenderer("line", transform, PivotValue.CENTER);
            lineRenderer.GetComponent <RectTransform> ().anchorMin = new Vector2(0.5f, 0.5f);
            lineRenderer.GetComponent <RectTransform> ().anchorMax = new Vector2(0.5f, 0.5f);
            lineRenderer.lineThickness = 2.0f;
        }