Ejemplo n.º 1
0
        private void InitAxisLabel()
        {
            var labelObject = ChartHelper.AddObject(s_AxisLabelObjectName, transform, m_ChartMinAnchor,
                                                    m_ChartMaxAnchor, m_ChartPivot, m_ChartSizeDelta);

            SerieLabelPool.ReleaseAll(labelObject.transform);
            for (int i = 0; i < m_Series.Count; i++)
            {
                var serie      = m_Series.list[i];
                var serieLabel = serie.gaugeAxis.axisLabel;
                var count      = serie.splitNumber > 36 ? 36 : (serie.splitNumber + 1);
                var startAngle = serie.startAngle;
                serie.gaugeAxis.ClearLabelObject();
                SerieHelper.UpdateCenter(serie, chartPosition, chartWidth, chartHeight);
                for (int j = 0; j < count; j++)
                {
                    var textName   = ChartCached.GetSerieLabelName(s_SerieLabelObjectName, i, j);
                    var color      = Color.grey;
                    var labelObj   = SerieLabelPool.Get(textName, labelObject.transform, serieLabel, m_ThemeInfo.font, color, 100, 100);
                    var iconImage  = labelObj.transform.Find("Icon").GetComponent <Image>();
                    var isAutoSize = serieLabel.backgroundWidth == 0 || serieLabel.backgroundHeight == 0;
                    var item       = new LabelObject();
                    item.SetLabel(labelObj, isAutoSize, serieLabel.paddingLeftRight, serieLabel.paddingTopBottom);
                    item.SetIcon(iconImage);
                    item.SetIconActive(false);
                    serie.gaugeAxis.AddLabelObject(item);
                }
                UpdateAxisLabel(serie);
            }
        }
Ejemplo n.º 2
0
        private void InitSerieLabel()
        {
            var labelObject = ChartHelper.AddObject(s_SerieLabelObjectName, transform, m_ChartMinAnchor,
                                                    m_ChartMaxAnchor, m_ChartPivot, m_ChartSizeDelta);

            SerieLabelPool.ReleaseAll(labelObject.transform);
            int count = 0;

            for (int i = 0; i < m_Series.Count; i++)
            {
                var serie = m_Series.list[i];
                SerieHelper.UpdateCenter(serie, chartPosition, chartWidth, chartHeight);
                for (int j = 0; j < serie.data.Count; j++)
                {
                    var serieData  = serie.data[j];
                    var serieLabel = SerieHelper.GetSerieLabel(serie, serieData);
                    if (!serieLabel.show && j > 100)
                    {
                        continue;
                    }
                    var textName = ChartCached.GetSerieLabelName(s_SerieLabelObjectName, i, j);
                    var color    = Color.grey;
                    if (serie.type == SerieType.Pie)
                    {
                        color = (serieLabel.position == SerieLabel.Position.Inside) ? Color.white :
                                (Color)m_ThemeInfo.GetColor(count);
                    }
                    else
                    {
                        color = serieLabel.color != Color.clear ? serieLabel.color :
                                (Color)m_ThemeInfo.GetColor(i);
                    }
                    var labelObj = SerieLabelPool.Get(textName, labelObject.transform, serieLabel, m_ThemeInfo.font, color,
                                                      serieData.iconStyle.width, serieData.iconStyle.height);
                    var iconImage = labelObj.transform.Find("Icon").GetComponent <Image>();
                    serieData.SetIconImage(iconImage);

                    var isAutoSize = serieLabel.backgroundWidth == 0 || serieLabel.backgroundHeight == 0;
                    serieData.InitLabel(labelObj, isAutoSize, serieLabel.paddingLeftRight, serieLabel.paddingTopBottom);
                    serieData.SetLabelActive(false);
                    count++;
                }
            }
            SerieLabelHelper.UpdateLabelText(m_Series, m_ThemeInfo);
        }
Ejemplo n.º 3
0
        private void InitSerieLabel()
        {
            var labelObject = ChartHelper.AddObject(s_SerieLabelObjectName, transform, chartAnchorMin,
                                                    chartAnchorMax, chartPivot, new Vector2(chartWidth, chartHeight));

            //ChartHelper.DestroyAllChildren(labelObject.transform);
            SerieLabelPool.ReleaseAll(labelObject.transform);
            int count = 0;

            for (int i = 0; i < m_Series.Count; i++)
            {
                var serie = m_Series.list[i];
                for (int j = 0; j < serie.data.Count; j++)
                {
                    var serieData = serie.data[j];
                    if (!serie.label.show && j > 100)
                    {
                        continue;
                    }
                    var textName = ChartCached.GetSerieLabelName(s_SerieLabelObjectName, i, j);
                    var color    = Color.grey;
                    if (serie.type == SerieType.Pie)
                    {
                        color = (serie.label.position == SerieLabel.Position.Inside) ? Color.white :
                                (Color)m_ThemeInfo.GetColor(count);
                    }
                    else
                    {
                        color = serie.label.color != Color.clear ? serie.label.color :
                                (Color)m_ThemeInfo.GetColor(i);
                    }
                    var labelObj = SerieLabelPool.Get(textName, labelObject.transform, serie.label, m_ThemeInfo.font, color, serieData);
                    var iconObj  = labelObj.transform.Find("Icon").gameObject;
                    serieData.SetIconObj(iconObj);

                    var isAutoSize = serie.label.backgroundWidth == 0 || serie.label.backgroundHeight == 0;
                    serieData.InitLabel(labelObj, isAutoSize, serie.label.paddingLeftRight, serie.label.paddingTopBottom);
                    serieData.SetLabelActive(false);
                    serieData.SetLabelText(serieData.name);

                    count++;
                }
            }
        }
Ejemplo n.º 4
0
        private void InitSerieLabel()
        {
            m_SerieLabelRoot = ChartHelper.AddObject(s_SerieLabelObjectName, transform, m_ChartMinAnchor,
                                                     m_ChartMaxAnchor, m_ChartPivot, m_ChartSizeDelta);
            SerieLabelPool.ReleaseAll(m_SerieLabelRoot.transform);
            int count = 0;

            for (int i = 0; i < m_Series.Count; i++)
            {
                var serie = m_Series.list[i];
                SerieHelper.UpdateCenter(serie, chartPosition, chartWidth, chartHeight);
                for (int j = 0; j < serie.data.Count; j++)
                {
                    var serieData = serie.data[j];
                    serieData.index = j;
                    AddSerieLabel(serie, serieData, count);
                    count++;
                }
            }
            SerieLabelHelper.UpdateLabelText(m_Series, m_ThemeInfo);
        }
        private void InitAxisLabel()
        {
            if (!SeriesHelper.ContainsSerie(chart.series, SerieType.Gauge))
            {
                return;
            }
            var labelObject = ChartHelper.AddObject(s_AxisLabelObjectName, chart.transform, chart.chartMinAnchor,
                                                    chart.chartMaxAnchor, chart.chartPivot, chart.chartSizeDelta);

            labelObject.hideFlags = chart.chartHideFlags;
            SerieLabelPool.ReleaseAll(labelObject.transform);
            for (int i = 0; i < chart.series.Count; i++)
            {
                var serie = chart.series.list[i];
                if (serie.type != SerieType.Gauge)
                {
                    continue;
                }
                var serieLabel = serie.gaugeAxis.axisLabel;
                var count      = serie.splitNumber > 36 ? 36 : (serie.splitNumber + 1);
                var startAngle = serie.startAngle;
                var textColor  = serieLabel.textStyle.GetColor(chart.theme.gauge.textColor);
                serie.gaugeAxis.ClearLabelObject();
                SerieHelper.UpdateCenter(serie, chart.chartPosition, chart.chartWidth, chart.chartHeight);
                for (int j = 0; j < count; j++)
                {
                    var textName   = ChartCached.GetSerieLabelName(s_SerieLabelObjectName, i, j);
                    var labelObj   = SerieLabelPool.Get(textName, labelObject.transform, serieLabel, textColor, 100, 100, chart.theme);
                    var iconImage  = labelObj.transform.Find("Icon").GetComponent <Image>();
                    var isAutoSize = serieLabel.backgroundWidth == 0 || serieLabel.backgroundHeight == 0;
                    var item       = new ChartLabel();
                    item.SetLabel(labelObj, isAutoSize, serieLabel.paddingLeftRight, serieLabel.paddingTopBottom);
                    item.SetIcon(iconImage);
                    item.SetIconActive(false);
                    serie.gaugeAxis.AddLabelObject(item);
                }
                UpdateAxisLabel(serie);
            }
        }