private void DrawGauge(VertexHelper vh, Serie serie)
        {
            SerieHelper.UpdateCenter(serie, chart.chartPosition, chart.chartWidth, chart.chartHeight);
            var destAngle = GetCurrAngle(serie, true);

            serie.animation.InitProgress(0, serie.startAngle, destAngle);
            var currAngle = serie.animation.IsFinish() ? GetCurrAngle(serie, false) : serie.animation.GetCurrDetail();

            DrawProgressBar(vh, serie, currAngle);
            DrawStageColor(vh, serie);
            DrawLineStyle(vh, serie);
            DrawAxisTick(vh, serie);
            DrawPointer(vh, serie, currAngle);
            TitleStyleHelper.CheckTitle(serie, ref chart.m_ReinitTitle, ref m_UpdateTitleText);
            SerieLabelHelper.CheckLabel(serie, ref chart.m_ReinitLabel, ref m_UpdateLabelText);
            CheckAnimation(serie);
            if (!serie.animation.IsFinish())
            {
                serie.animation.CheckProgress(destAngle - serie.startAngle);
                chart.RefreshPainter(serie);
            }
            else if (NeedRefresh(serie))
            {
                chart.RefreshPainter(serie);
            }
        }
        public void Update()
        {
            if (m_UpdateTitleText)
            {
                m_UpdateTitleText = false;

                foreach (var serie in chart.series.list)
                {
                    if (serie.type == SerieType.Gauge)
                    {
                        TitleStyleHelper.UpdateTitleText(serie);
                    }
                }
            }
            if (m_UpdateLabelText)
            {
                m_UpdateLabelText = false;
                foreach (var serie in chart.series.list)
                {
                    if (serie.type == SerieType.Gauge)
                    {
                        SerieLabelHelper.SetGaugeLabelText(serie);
                        UpdateAxisLabel(serie);
                    }
                }
            }
        }
Example #3
0
 public void Update()
 {
     if (m_UpdateTitleText)
     {
         m_UpdateTitleText = false;
         foreach (var serie in chart.series.list)
         {
             if (serie.type == SerieType.Ring)
             {
                 TitleStyleHelper.UpdateTitleText(serie);
             }
         }
     }
     if (m_UpdateLabelText)
     {
         m_UpdateLabelText = false;
         foreach (var serie in chart.series.list)
         {
             if (serie.type == SerieType.Ring)
             {
                 SerieLabelHelper.SetRingLabelText(serie, chart.theme);
             }
         }
     }
 }
Example #4
0
 protected override void Start()
 {
     base.Start();
     foreach (var serie in m_Series.list)
     {
         TitleStyleHelper.CheckTitle(serie, ref m_ReinitTitle, ref m_UpdateTitleText);
         SerieLabelHelper.CheckLabel(serie, ref m_ReinitLabel, ref m_UpdateLabelText);
     }
     UpdateAxisLabel();
 }
Example #5
0
 protected override void Update()
 {
     base.Update();
     if (m_UpdateTitleText)
     {
         m_UpdateTitleText = false;
         TitleStyleHelper.UpdateTitleText(m_Series);
     }
     if (m_UpdateLabelText)
     {
         m_UpdateLabelText = false;
         SerieLabelHelper.UpdateLabelText(m_Series, m_ThemeInfo);
     }
 }
Example #6
0
 protected override void Update()
 {
     base.Update();
     if (m_UpdateTitleText)
     {
         m_UpdateTitleText = false;
         TitleStyleHelper.UpdateTitleText(m_Series);
     }
     if (m_UpdateLabelText)
     {
         m_UpdateLabelText = false;
         SerieLabelHelper.UpdateLabelText(m_Series, m_ThemeInfo, m_LegendRealShowName);
         UpdateAxisLabel();
     }
 }
        public void Update()
        {
            if (m_UpdateTitleText)
            {
                m_UpdateTitleText = false;

                foreach (var serie in chart.series.list)
                {
                    if (serie.type == SerieType.Gauge)
                    {
                        TitleStyleHelper.UpdateTitleText(serie);
                    }
                }
            }
            if (m_UpdateLabelText)
            {
                m_UpdateLabelText = false;
                foreach (var serie in chart.series.list)
                {
                    if (serie.type == SerieType.Gauge)
                    {
                        SerieLabelHelper.SetGaugeLabelText(serie);
                        UpdateAxisLabel(serie);
                    }
                }
            }
            foreach (var serie in chart.series.list)
            {
                if (serie.type == SerieType.Gauge)
                {
                    if (!m_LastSplitNumber.TryGetValue(serie.index, out var lastSplitNumber))
                    {
                        m_LastSplitNumber[serie.index] = lastSplitNumber;
                    }
                    else if (serie.splitNumber != lastSplitNumber)
                    {
                        m_LastSplitNumber[serie.index] = serie.splitNumber;
                        InitAxisLabel();
                    }
                }
            }
        }
Example #8
0
        protected override void DrawChart(VertexHelper vh)
        {
            base.DrawChart(vh);
            for (int i = 0; i < m_Series.list.Count; i++)
            {
                var serie = m_Series.list[i];
                var data  = serie.data;
                serie.index = i;
                if (!serie.show || serie.type != SerieType.Ring || serie.animation.HasFadeOut())
                {
                    continue;
                }
                serie.animation.InitProgress(data.Count, serie.startAngle, serie.startAngle + 360);
                serie.UpdateCenter(chartWidth, chartHeight);
                TitleStyleHelper.CheckTitle(serie, ref m_ReinitTitle, ref m_UpdateTitleText);
                SerieLabelHelper.CheckLabel(serie, ref m_ReinitLabel, ref m_UpdateLabelText);
                var dataChangeDuration = serie.animation.GetUpdateAnimationDuration();
                var ringWidth          = serie.runtimeOutsideRadius - serie.runtimeInsideRadius;
                var dataChanging       = false;
                for (int j = 0; j < data.Count; j++)
                {
                    var serieData = data[j];
                    if (!serieData.show)
                    {
                        continue;
                    }
                    if (serieData.IsDataChanged())
                    {
                        dataChanging = true;
                    }
                    var value         = serieData.GetFirstData(dataChangeDuration);
                    var max           = serieData.GetLastData();
                    var degree        = 360 * value / max;
                    var startDegree   = GetStartAngle(serie);
                    var toDegree      = GetToAngle(serie, degree);
                    var itemColor     = SerieHelper.GetItemColor(serie, serieData, m_ThemeInfo, j, serieData.highlighted);
                    var outsideRadius = serie.runtimeOutsideRadius - j * (ringWidth + serie.ringGap);
                    var insideRadius  = outsideRadius - ringWidth;
                    var centerRadius  = (outsideRadius + insideRadius) / 2;

                    serieData.runtimePieStartAngle    = serie.clockwise ? startDegree : toDegree;
                    serieData.runtimePieToAngle       = serie.clockwise ? toDegree : startDegree;
                    serieData.runtimePieInsideRadius  = insideRadius;
                    serieData.runtimePieOutsideRadius = outsideRadius;

                    DrawBackground(vh, serie, serieData, j, insideRadius, outsideRadius);
                    DrawRoundCap(vh, serie, serie.runtimeCenterPos, itemColor, insideRadius, outsideRadius,
                                 ref startDegree, ref toDegree);
                    ChartDrawer.DrawDoughnut(vh, serie.runtimeCenterPos, insideRadius,
                                             outsideRadius, itemColor, Color.clear, m_Settings.cicleSmoothness,
                                             startDegree, toDegree);
                    DrawBorder(vh, serie, serieData, insideRadius, outsideRadius);
                    DrawCenter(vh, serie, serieData, insideRadius, j == data.Count - 1);
                    UpateLabelPosition(serie, serieData, j, startDegree, toDegree, centerRadius);
                }
                if (!serie.animation.IsFinish())
                {
                    serie.animation.CheckProgress(360);
                    serie.animation.CheckSymbol(serie.symbol.size);
                    RefreshChart();
                }
                if (dataChanging)
                {
                    RefreshChart();
                }
            }
        }
Example #9
0
        public void DrawSerie(VertexHelper vh, Serie serie)
        {
            if (serie.type != SerieType.Ring)
            {
                return;
            }
            if (!serie.show || serie.animation.HasFadeOut())
            {
                return;
            }
            var data = serie.data;

            serie.animation.InitProgress(data.Count, serie.startAngle, serie.startAngle + 360);
            SerieHelper.UpdateCenter(serie, chart.chartPosition, chart.chartWidth, chart.chartHeight);
            TitleStyleHelper.CheckTitle(serie, ref chart.m_ReinitTitle, ref m_UpdateTitleText);
            SerieLabelHelper.CheckLabel(serie, ref chart.m_ReinitLabel, ref m_UpdateLabelText);
            var dataChangeDuration = serie.animation.GetUpdateAnimationDuration();
            var ringWidth          = serie.runtimeOutsideRadius - serie.runtimeInsideRadius;
            var dataChanging       = false;

            for (int j = 0; j < data.Count; j++)
            {
                var serieData = data[j];
                if (!serieData.show)
                {
                    continue;
                }
                if (serieData.IsDataChanged())
                {
                    dataChanging = true;
                }
                var value         = serieData.GetFirstData(dataChangeDuration);
                var max           = serieData.GetLastData();
                var degree        = 360 * value / max;
                var startDegree   = GetStartAngle(serie);
                var toDegree      = GetToAngle(serie, degree);
                var itemStyle     = SerieHelper.GetItemStyle(serie, serieData, serieData.highlighted);
                var itemColor     = SerieHelper.GetItemColor(serie, serieData, chart.theme, j, serieData.highlighted);
                var itemToColor   = SerieHelper.GetItemToColor(serie, serieData, chart.theme, j, serieData.highlighted);
                var outsideRadius = serie.runtimeOutsideRadius - j * (ringWidth + serie.ringGap);
                var insideRadius  = outsideRadius - ringWidth;
                var centerRadius  = (outsideRadius + insideRadius) / 2;
                var borderWidth   = itemStyle.borderWidth;
                var borderColor   = itemStyle.borderColor;
                var roundCap      = serie.roundCap && insideRadius > 0;

                serieData.runtimePieStartAngle    = serie.clockwise ? startDegree : toDegree;
                serieData.runtimePieToAngle       = serie.clockwise ? toDegree : startDegree;
                serieData.runtimePieInsideRadius  = insideRadius;
                serieData.runtimePieOutsideRadius = outsideRadius;
                UGL.DrawDoughnut(vh, serie.runtimeCenterPos, insideRadius, outsideRadius, itemColor, itemToColor,
                                 Color.clear, startDegree, toDegree, borderWidth, borderColor, 0, chart.settings.cicleSmoothness,
                                 roundCap, serie.clockwise);
                DrawCenter(vh, serie, serieData, insideRadius, j == data.Count - 1);
                UpateLabelPosition(serie, serieData, j, startDegree, toDegree, centerRadius);
            }
            if (!serie.animation.IsFinish())
            {
                serie.animation.CheckProgress(360);
                chart.RefreshChart();
            }
            if (dataChanging)
            {
                chart.RefreshChart();
            }
        }