private void Awake()
 {
     SerieLabelPool.ClearAll();
     m_ChartList.Clear();
     m_ThemeDict.Clear();
     LoadThemesFromResources();
 }
示例#2
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);
            }
        }
示例#3
0
 private void Awake()
 {
     if (m_XCharts != null)
     {
         GameObject.DestroyImmediate(this);
         return;
     }
     SerieLabelPool.ClearAll();
     m_ChartList.Clear();
     XThemeMgr.ReloadThemeList();
 }
        protected void AddSerieLabel(Serie serie, SerieData serieData, int count = -1)
        {
            if (m_SerieLabelRoot == null)
            {
                return;
            }
            if (count == -1)
            {
                count = serie.dataCount;
            }
            var serieLabel = SerieHelper.GetSerieLabel(serie, serieData);
            var iconStyle  = SerieHelper.GetIconStyle(serie, serieData);

            if (serie.IsPerformanceMode())
            {
                return;
            }
            if (!serieLabel.show && !iconStyle.show)
            {
                return;
            }
            if (serie.animation.enable && serie.animation.HasFadeOut())
            {
                return;
            }
            var textName = ChartCached.GetSerieLabelName(s_SerieLabelObjectName, serie.index, serieData.index);
            var color    = Color.grey;

            if (serie.type == SerieType.Pie)
            {
                color = (serieLabel.position == SerieLabel.Position.Inside) ? Color.white :
                        (Color)m_Theme.GetColor(count);
            }
            else
            {
                color = !ChartHelper.IsClearColor(serieLabel.textStyle.color) ? serieLabel.textStyle.color :
                        (Color)m_Theme.GetColor(serie.index);
            }
            var labelObj = SerieLabelPool.Get(textName, m_SerieLabelRoot.transform, serieLabel, color,
                                              iconStyle.width, iconStyle.height, 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(iconStyle.show);
            serieData.labelObject = item;
        }
示例#5
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);
        }
示例#6
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++;
                }
            }
        }
示例#7
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);
            }
        }
示例#9
0
 private void Awake()
 {
     SerieLabelPool.ClearAll();
     m_ChartList.Clear();
 }
示例#10
0
 void OnSceneLoaded(Scene scene)
 {
     SerieLabelPool.ClearAll();
 }
示例#11
0
 private void Awake()
 {
     SerieLabelPool.ClearAll();
 }
示例#12
0
 private void Awake()
 {
     SerieLabelPool.ClearAll();
     m_ChartList.Clear();
     XThemeMgr.ReloadThemeList();
 }