Пример #1
0
        private void DrawCenter(VertexHelper vh, Serie serie, SerieData serieData, float insideRadius, bool last)
        {
            var itemStyle = SerieHelper.GetItemStyle(serie, serieData);

            if (itemStyle.centerColor != Color.clear && last)
            {
                var radius     = insideRadius - itemStyle.centerGap;
                var smoothness = m_Settings.cicleSmoothness;
                ChartDrawer.DrawCricle(vh, serie.runtimeCenterPos, radius, itemStyle.centerColor, smoothness);
            }
        }
Пример #2
0
        private static string GetItemNumericFormatter(Tooltip tooltip, Serie serie, SerieData serieData)
        {
            var itemStyle = SerieHelper.GetItemStyle(serie, serieData);

            if (!string.IsNullOrEmpty(itemStyle.numericFormatter))
            {
                return(itemStyle.numericFormatter);
            }
            else
            {
                return(tooltip.numericFormatter);
            }
        }
Пример #3
0
        public static string GetNumericFormatter(Serie serie, SerieData serieData)
        {
            var itemStyle = SerieHelper.GetItemStyle(serie, serieData);

            if (!string.IsNullOrEmpty(itemStyle.numericFormatter))
            {
                return(itemStyle.numericFormatter);
            }
            else
            {
                return(string.Empty);
            }
        }
Пример #4
0
        private void DrawBorder(VertexHelper vh, Serie serie, SerieData serieData, float insideRadius, float outsideRadius)
        {
            var itemStyle = SerieHelper.GetItemStyle(serie, serieData);

            if (itemStyle.show && itemStyle.borderWidth > 0 && itemStyle.borderColor != Color.clear)
            {
                ChartDrawer.DrawDoughnut(vh, serie.runtimeCenterPos, outsideRadius,
                                         outsideRadius + itemStyle.borderWidth, itemStyle.borderColor,
                                         Color.clear, m_Settings.cicleSmoothness);
                ChartDrawer.DrawDoughnut(vh, serie.runtimeCenterPos, insideRadius,
                                         insideRadius + itemStyle.borderWidth, itemStyle.borderColor,
                                         Color.clear, m_Settings.cicleSmoothness);
            }
        }
Пример #5
0
        private void DrawBackground(VertexHelper vh, Serie serie, SerieData serieData, int index, float insideRadius, float outsideRadius)
        {
            var itemStyle       = SerieHelper.GetItemStyle(serie, serieData);
            var backgroundColor = SerieHelper.GetItemBackgroundColor(serie, serieData, m_ThemeInfo, index, false);

            if (itemStyle.backgroundWidth != 0)
            {
                var centerRadius = (outsideRadius + insideRadius) / 2;
                var inradius     = centerRadius - itemStyle.backgroundWidth / 2;
                var outradius    = centerRadius + itemStyle.backgroundWidth / 2;
                ChartDrawer.DrawDoughnut(vh, serie.runtimeCenterPos, inradius,
                                         outradius, backgroundColor, Color.clear, m_Settings.cicleSmoothness);
            }
            else
            {
                ChartDrawer.DrawDoughnut(vh, serie.runtimeCenterPos, insideRadius,
                                         outsideRadius, backgroundColor, Color.clear, m_Settings.cicleSmoothness);
            }
        }
Пример #6
0
        protected override void DrawChart(VertexHelper vh)
        {
            base.DrawChart(vh);
            int  serieNameCount  = -1;
            bool isClickOffset   = false;
            bool isDataHighlight = false;

            for (int i = 0; i < m_Series.Count; i++)
            {
                var serie = m_Series.list[i];
                serie.index = i;
                var data = serie.data;
                serie.animation.InitProgress(data.Count, 0, 360);
                if (!serie.show || serie.animation.HasFadeOut())
                {
                    continue;
                }
                bool isFinish = true;
                if (serie.pieClickOffset)
                {
                    isClickOffset = true;
                }
                serie.runtimePieDataMax   = serie.yMax;
                serie.runtimePieDataTotal = serie.yTotal;
                SerieHelper.UpdateCenter(serie, chartPosition, chartWidth, chartHeight);

                float totalDegree   = 360;
                float startDegree   = 0;
                int   showdataCount = 0;
                foreach (var sd in serie.data)
                {
                    if (sd.show && serie.pieRoseType == RoseType.Area)
                    {
                        showdataCount++;
                    }
                    sd.canShowLabel = false;
                }
                bool  dataChanging       = false;
                float dataChangeDuration = serie.animation.GetUpdateAnimationDuration();
                for (int n = 0; n < data.Count; n++)
                {
                    var serieData = data[n];
                    var itemStyle = SerieHelper.GetItemStyle(serie, serieData, serieData.highlighted);
                    serieData.index = n;
                    float value = serieData.GetCurrData(1, dataChangeDuration);
                    if (serieData.IsDataChanged())
                    {
                        dataChanging = true;
                    }
                    serieNameCount = m_LegendRealShowName.IndexOf(serieData.legendName);
                    var color       = SerieHelper.GetItemColor(serie, serieData, m_ThemeInfo, serieNameCount, serieData.highlighted);
                    var toColor     = SerieHelper.GetItemToColor(serie, serieData, m_ThemeInfo, serieNameCount, serieData.highlighted);
                    var borderWidth = itemStyle.borderWidth;
                    var borderColor = itemStyle.borderColor;

                    serieData.runtimePieStartAngle = startDegree;
                    serieData.runtimePieToAngle    = startDegree;
                    serieData.runtimePieHalfAngle  = startDegree;
                    serieData.runtimePieCurrAngle  = startDegree;
                    if (!serieData.show)
                    {
                        continue;
                    }
                    float degree = serie.pieRoseType == RoseType.Area ?
                                   (totalDegree / showdataCount) : (totalDegree * value / serie.runtimePieDataTotal);
                    serieData.runtimePieToAngle = startDegree + degree;

                    serieData.runtimePieOutsideRadius = serie.pieRoseType > 0 ?
                                                        serie.runtimeInsideRadius + (serie.runtimeOutsideRadius - serie.runtimeInsideRadius) * value / serie.runtimePieDataMax :
                                                        serie.runtimeOutsideRadius;
                    if (serieData.highlighted)
                    {
                        isDataHighlight = true;
                        serieData.runtimePieOutsideRadius += m_Settings.pieTooltipExtraRadius;
                    }
                    var offset = 0f;
                    if (serie.pieClickOffset && serieData.selected)
                    {
                        offset += m_Settings.pieSelectedOffset;
                    }
                    var halfDegree = (serieData.runtimePieToAngle - startDegree) / 2;
                    serieData.runtimePieHalfAngle = startDegree + halfDegree;
                    float currRad = serieData.runtimePieHalfAngle * Mathf.Deg2Rad;
                    float currSin = Mathf.Sin(currRad);
                    float currCos = Mathf.Cos(currRad);
                    var   center  = serie.runtimeCenterPos;

                    serieData.runtimePieCurrAngle    = serieData.runtimePieToAngle;
                    serieData.runtiemPieOffsetCenter = center;
                    serieData.runtimePieInsideRadius = serie.runtimeInsideRadius;
                    if (serie.animation.CheckDetailBreak(serieData.runtimePieToAngle))
                    {
                        isFinish = false;
                        serieData.runtimePieCurrAngle = serie.animation.GetCurrDetail();
                    }
                    if (offset > 0)
                    {
                        serieData.runtimePieOffsetRadius   = 0;
                        serieData.runtimePieInsideRadius  -= serieData.runtimePieOffsetRadius;
                        serieData.runtimePieOutsideRadius -= serieData.runtimePieOffsetRadius;
                        if (serie.pieClickOffset && serieData.selected)
                        {
                            serieData.runtimePieOffsetRadius += m_Settings.pieSelectedOffset;
                            if (serieData.runtimePieInsideRadius > 0)
                            {
                                serieData.runtimePieInsideRadius += m_Settings.pieSelectedOffset;
                            }
                            serieData.runtimePieOutsideRadius += m_Settings.pieSelectedOffset;
                        }

                        serieData.runtiemPieOffsetCenter = new Vector3(center.x + serieData.runtimePieOffsetRadius * currSin,
                                                                       center.y + serieData.runtimePieOffsetRadius * currCos);
                        var drawEndDegree = serieData.runtimePieCurrAngle;
                        var needRoundCap  = serie.roundCap && serieData.runtimePieInsideRadius > 0;
                        ChartDrawer.DrawDoughnut(vh, serieData.runtiemPieOffsetCenter, serieData.runtimePieInsideRadius,
                                                 serieData.runtimePieOutsideRadius, color, toColor, Color.clear, startDegree, drawEndDegree,
                                                 borderWidth, borderColor, serie.pieSpace / 2, m_Settings.cicleSmoothness, needRoundCap, serie.clockwise);
                    }
                    else //if(n==0)
                    {
                        var drawEndDegree = serieData.runtimePieCurrAngle;
                        var needRoundCap  = serie.roundCap && serieData.runtimePieInsideRadius > 0;
                        ChartDrawer.DrawDoughnut(vh, center, serieData.runtimePieInsideRadius, serieData.runtimePieOutsideRadius,
                                                 color, toColor, Color.clear, startDegree, drawEndDegree, borderWidth, borderColor, serie.pieSpace / 2,
                                                 m_Settings.cicleSmoothness, needRoundCap, serie.clockwise);
                        DrawCenter(vh, serie, itemStyle, serieData.runtimePieInsideRadius);
                    }
                    serieData.canShowLabel = serieData.runtimePieCurrAngle >= serieData.runtimePieHalfAngle;
                    isDrawPie   = true;
                    startDegree = serieData.runtimePieToAngle;
                    if (isFinish)
                    {
                        serie.animation.SetDataFinish(n);
                    }
                    else
                    {
                        break;
                    }
                }
                if (!serie.animation.IsFinish())
                {
                    serie.animation.CheckProgress(360);
                    serie.animation.CheckSymbol(serie.symbol.size);
                    RefreshChart();
                }
                if (dataChanging)
                {
                    RefreshChart();
                }
            }
            DrawLabelLine(vh);
            DrawLabelBackground(vh);
            raycastTarget = isClickOffset && isDataHighlight;
        }
Пример #7
0
        private void DrawPie(VertexHelper vh, Serie serie)
        {
            var data = serie.data;

            serie.animation.InitProgress(data.Count, 0, 360);
            if (!serie.show || serie.animation.HasFadeOut())
            {
                return;
            }
            bool dataChanging = false;

            for (int n = 0; n < data.Count; n++)
            {
                var serieData = data[n];
                if (!serieData.show)
                {
                    continue;
                }
                var itemStyle = SerieHelper.GetItemStyle(serie, serieData, serieData.highlighted);
                if (serieData.IsDataChanged())
                {
                    dataChanging = true;
                }
                var serieNameCount = chart.m_LegendRealShowName.IndexOf(serieData.legendName);
                var color          = SerieHelper.GetItemColor(serie, serieData, chart.theme, serieNameCount,
                                                              serieData.highlighted);
                var toColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, serieNameCount,
                                                         serieData.highlighted);
                var borderWidth = itemStyle.borderWidth;
                var borderColor = itemStyle.borderColor;

                if (serie.pieClickOffset && serieData.selected)
                {
                    var drawEndDegree = serieData.runtimePieCurrAngle;
                    var needRoundCap  = serie.roundCap && serieData.runtimePieInsideRadius > 0;
                    UGL.DrawDoughnut(vh, serieData.runtiemPieOffsetCenter, serieData.runtimePieInsideRadius,
                                     serieData.runtimePieOutsideRadius, color, toColor, Color.clear, serieData.runtimePieStartAngle,
                                     drawEndDegree, borderWidth, borderColor, serie.pieSpace / 2, chart.settings.cicleSmoothness,
                                     needRoundCap, true);
                }
                else
                {
                    var drawEndDegree = serieData.runtimePieCurrAngle;
                    var needRoundCap  = serie.roundCap && serieData.runtimePieInsideRadius > 0;
                    UGL.DrawDoughnut(vh, serie.runtimeCenterPos, serieData.runtimePieInsideRadius,
                                     serieData.runtimePieOutsideRadius, color, toColor, Color.clear, serieData.runtimePieStartAngle,
                                     drawEndDegree, borderWidth, borderColor, serie.pieSpace / 2, chart.settings.cicleSmoothness,
                                     needRoundCap, true);
                    DrawPieCenter(vh, serie, itemStyle, serieData.runtimePieInsideRadius);
                }
                if (!serie.animation.CheckDetailBreak(serieData.runtimePieToAngle))
                {
                    serie.animation.SetDataFinish(n);
                }
                else
                {
                    break;
                }
            }
            if (!serie.animation.IsFinish())
            {
                serie.animation.CheckProgress(360);
                serie.animation.CheckSymbol(serie.symbol.GetSize(null, chart.theme.serie.lineSymbolSize));
                chart.RefreshPainter(serie);
            }
            if (dataChanging)
            {
                chart.RefreshPainter(serie);
            }
            chart.raycastTarget = IsAnyPieClickOffset() || IsAnyPieDataHighlight();
        }
        protected void DrawYBarSerie(VertexHelper vh, Serie serie, int colorIndex)
        {
            if (!IsActive(serie.name))
            {
                return;
            }
            if (serie.animation.HasFadeOut())
            {
                return;
            }
            var   xAxis         = m_XAxes[serie.xAxisIndex];
            var   yAxis         = m_YAxes[serie.yAxisIndex];
            var   grid          = GetSerieGridOrDefault(serie);
            var   showData      = serie.GetDataList(dataZoom);
            float categoryWidth = AxisHelper.GetDataWidth(yAxis, grid.runtimeHeight, showData.Count, dataZoom);
            float barGap        = Internal_GetBarGap(SerieType.Bar);
            float totalBarWidth = Internal_GetBarTotalWidth(categoryWidth, barGap, SerieType.Bar);
            float barWidth      = serie.GetBarWidth(categoryWidth);
            float offset        = (categoryWidth - totalBarWidth) / 2;
            float barGapWidth   = barWidth + barWidth * barGap;
            float space         = serie.barGap == -1 ? offset : offset + Internal_GetBarIndex(serie, SerieType.Bar) * barGapWidth;
            var   isStack       = SeriesHelper.IsStack(m_Series, serie.stack, SerieType.Bar);

            m_StackSerieData.Clear();
            if (isStack)
            {
                SeriesHelper.UpdateStackDataList(m_Series, serie, dataZoom, m_StackSerieData);
            }

            int maxCount = serie.maxShow > 0 ?
                           (serie.maxShow > showData.Count ? showData.Count : serie.maxShow)
                : showData.Count;
            var   isPercentStack     = SeriesHelper.IsPercentStack(m_Series, serie.stack, SerieType.Bar);
            bool  dataChanging       = false;
            float dataChangeDuration = serie.animation.GetUpdateAnimationDuration();
            float xMinValue          = xAxis.GetCurrMinValue(dataChangeDuration);
            float xMaxValue          = xAxis.GetCurrMaxValue(dataChangeDuration);
            var   isAllBarEnd        = true;

            for (int i = serie.minShow; i < maxCount; i++)
            {
                var serieData = showData[i];
                if (serie.IsIgnoreValue(serieData))
                {
                    serie.dataPoints.Add(Vector3.zero);
                    continue;
                }
                var highlight = (tooltip.show && tooltip.IsSelected(i)) ||
                                serie.data[i].highlighted ||
                                serie.highlighted;
                var itemStyle = SerieHelper.GetItemStyle(serie, serieData, highlight);

                serieData.canShowLabel = true;
                float value       = showData[i].GetCurrData(1, dataChangeDuration, xAxis.inverse, xMinValue, xMaxValue);
                float borderWidth = value == 0 ? 0 : itemStyle.runtimeBorderWidth;
                if (showData[i].IsDataChanged())
                {
                    dataChanging = true;
                }
                float axisLineWidth = value == 0 ? 0
                    : ((value < 0 ? -1 : 1) * yAxis.axisLine.GetWidth(m_Theme.axis.lineWidth));

                float pY = grid.runtimeY + i * categoryWidth;
                if (!yAxis.boundaryGap)
                {
                    pY -= categoryWidth / 2;
                }
                float pX = grid.runtimeX + xAxis.runtimeZeroXOffset + axisLineWidth;
                if (isStack)
                {
                    for (int n = 0; n < m_StackSerieData.Count - 1; n++)
                    {
                        pX += m_StackSerieData[n][i].runtimeStackHig;
                    }
                }

                var barHig     = 0f;
                var valueTotal = 0f;
                if (isPercentStack)
                {
                    valueTotal = Internal_GetBarSameStackTotalValue(serie.stack, i, SerieType.Bar);
                    barHig     = valueTotal != 0 ? (value / valueTotal * grid.runtimeWidth) : 0;
                }
                else
                {
                    if (yAxis.IsLog())
                    {
                        int   minIndex = xAxis.runtimeMinLogIndex;
                        float nowIndex = xAxis.GetLogValue(value);
                        barHig = (nowIndex - minIndex) / xAxis.splitNumber * grid.runtimeWidth;
                    }
                    else
                    {
                        valueTotal = xMaxValue - xMinValue;
                        if (valueTotal != 0)
                        {
                            barHig = (xMinValue > 0 ? value - xMinValue : value)
                                     / valueTotal * grid.runtimeWidth;
                        }
                    }
                }
                serieData.runtimeStackHig = barHig;
                var   isBarEnd = false;
                float currHig  = Internal_CheckBarAnimation(serie, i, barHig, out isBarEnd);
                if (!isBarEnd)
                {
                    isAllBarEnd = false;
                }
                Vector3 plt, prt, prb, plb, top;
                if (value < 0)
                {
                    plt = new Vector3(pX - borderWidth, pY + space + barWidth - borderWidth);
                    prt = new Vector3(pX + currHig + borderWidth, pY + space + barWidth - borderWidth);
                    prb = new Vector3(pX + currHig + borderWidth, pY + space + borderWidth);
                    plb = new Vector3(pX - borderWidth, pY + space + borderWidth);
                }
                else
                {
                    plt = new Vector3(pX + borderWidth, pY + space + barWidth - borderWidth);
                    prt = new Vector3(pX + currHig - borderWidth, pY + space + barWidth - borderWidth);
                    prb = new Vector3(pX + currHig - borderWidth, pY + space + borderWidth);
                    plb = new Vector3(pX + borderWidth, pY + space + borderWidth);
                }
                top = new Vector3(pX + currHig - borderWidth, pY + space + barWidth / 2);
                if (serie.clip)
                {
                    plt = ClampInGrid(grid, plt);
                    prt = ClampInGrid(grid, prt);
                    prb = ClampInGrid(grid, prb);
                    plb = ClampInGrid(grid, plb);
                    top = ClampInGrid(grid, top);
                }
                serie.dataPoints.Add(top);
                if (serie.show)
                {
                    switch (serie.barType)
                    {
                    case BarType.Normal:
                        DrawNormalBar(vh, serie, serieData, itemStyle, colorIndex, highlight, space, barWidth,
                                      pX, pY, plb, plt, prt, prb, true, grid);
                        break;

                    case BarType.Zebra:
                        DrawZebraBar(vh, serie, serieData, itemStyle, colorIndex, highlight, space, barWidth,
                                     pX, pY, plb, plt, prt, prb, true, grid);
                        break;

                    case BarType.Capsule:
                        DrawCapsuleBar(vh, serie, serieData, itemStyle, colorIndex, highlight, space, barWidth,
                                       pX, pY, plb, plt, prt, prb, true, grid);
                        break;
                    }
                }
            }
            if (isAllBarEnd)
            {
                serie.animation.AllBarEnd();
            }
            if (dataChanging)
            {
                RefreshPainter(serie);
            }
        }
Пример #9
0
        protected void DrawXBarSerie(VertexHelper vh, Serie serie, int colorIndex, ref List <float> seriesHig)
        {
            if (!IsActive(serie.name))
            {
                return;
            }
            if (serie.animation.HasFadeOut())
            {
                return;
            }
            var showData = serie.GetDataList(m_DataZoom);
            var yAxis    = m_YAxises[serie.axisIndex];
            var xAxis    = m_XAxises[serie.axisIndex];

            if (!xAxis.show)
            {
                xAxis = m_XAxises[(serie.axisIndex + 1) % m_XAxises.Count];
            }

            float categoryWidth = xAxis.GetDataWidth(coordinateWidth, showData.Count, m_DataZoom);
            float barGap        = GetBarGap();
            float totalBarWidth = GetBarTotalWidth(categoryWidth, barGap);
            float barWidth      = serie.GetBarWidth(categoryWidth);
            float offset        = (categoryWidth - totalBarWidth) / 2;
            float barGapWidth   = barWidth + barWidth * barGap;
            float space         = serie.barGap == -1 ? offset : offset + m_BarLastOffset;
            int   maxCount      = serie.maxShow > 0 ?
                                  (serie.maxShow > showData.Count ? showData.Count : serie.maxShow)
                : showData.Count;

            if (seriesHig.Count < serie.minShow)
            {
                for (int i = 0; i < serie.minShow; i++)
                {
                    seriesHig.Add(0);
                }
            }

            var   isPercentStack     = m_Series.IsPercentStack(serie.stack, SerieType.Bar);
            bool  dataChanging       = false;
            float dataChangeDuration = serie.animation.GetUpdateAnimationDuration();
            float yMinValue          = yAxis.GetCurrMinValue(dataChangeDuration);
            float yMaxValue          = yAxis.GetCurrMaxValue(dataChangeDuration);

            for (int i = serie.minShow; i < maxCount; i++)
            {
                if (i >= seriesHig.Count)
                {
                    seriesHig.Add(0);
                }
                var serieData = showData[i];
                if (serie.IsIgnoreValue(serieData.GetData(1)))
                {
                    serie.dataPoints.Add(Vector3.zero);
                    continue;
                }
                var highlight = (m_Tooltip.show && m_Tooltip.IsSelected(i)) ||
                                serie.data[i].highlighted ||
                                serie.highlighted;
                var   itemStyle   = SerieHelper.GetItemStyle(serie, serieData, highlight);
                var   borderWidth = itemStyle.runtimeBorderWidth;
                float value       = serieData.GetCurrData(1, dataChangeDuration);
                if (serieData.IsDataChanged())
                {
                    dataChanging = true;
                }
                float pX    = coordinateX + i * categoryWidth;
                float zeroY = coordinateY + yAxis.runtimeZeroYOffset;
                if (!xAxis.boundaryGap)
                {
                    pX -= categoryWidth / 2;
                }
                float pY = seriesHig[i] + zeroY + xAxis.axisLine.width;

                var barHig     = 0f;
                var valueTotal = 0f;
                if (isPercentStack)
                {
                    valueTotal    = GetSameStackTotalValue(serie.stack, i);
                    barHig        = valueTotal != 0 ? (value / valueTotal * coordinateHeight) : 0;
                    seriesHig[i] += barHig;
                }
                else
                {
                    valueTotal = yMaxValue - yMinValue;
                    if (valueTotal != 0)
                    {
                        barHig = (yMinValue > 0 ? value - yMinValue : value)
                                 / valueTotal * coordinateHeight;
                    }
                    seriesHig[i] += barHig;
                }

                float   currHig = CheckAnimation(serie, i, barHig);
                Vector3 p1      = new Vector3(pX + space + borderWidth, pY + borderWidth);
                Vector3 p2      = new Vector3(pX + space + borderWidth, pY + currHig - 2 * borderWidth);
                Vector3 p3      = new Vector3(pX + space + barWidth, pY + currHig - 2 * borderWidth);
                Vector3 p4      = new Vector3(pX + space + barWidth, pY + borderWidth);
                Vector3 top     = new Vector3(pX + space + barWidth / 2, pY + currHig - borderWidth);
                p1  = ClampInCoordinate(p1);
                p2  = ClampInCoordinate(p2);
                p3  = ClampInCoordinate(p3);
                p4  = ClampInCoordinate(p4);
                top = ClampInCoordinate(top);
                serie.dataPoints.Add(top);

                if (serie.show)
                {
                    Color areaColor   = SerieHelper.GetItemColor(serie, serieData, m_ThemeInfo, colorIndex, highlight);
                    Color areaToColor = SerieHelper.GetItemToColor(serie, serieData, m_ThemeInfo, colorIndex, highlight);
                    DrawBarBackground(vh, serie, serieData, colorIndex, highlight, pX, pY, space, barWidth, false);
                    if (serie.barType == BarType.Zebra)
                    {
                        p1 = (p4 + p1) / 2;
                        p2 = (p2 + p3) / 2;
                        CheckClipAndDrawZebraLine(vh, p1, p2, barWidth / 2, serie.barZebraWidth, serie.barZebraGap,
                                                  areaColor, serie.clip);
                    }
                    else
                    {
                        CheckClipAndDrawPolygon(vh, ref p4, ref p1, ref p2, ref p3, areaColor, areaToColor, serie.clip);
                        if (borderWidth > 0)
                        {
                            var borderColor = itemStyle.borderColor;
                            var itemWidth   = Mathf.Abs(p3.x - p1.x);
                            var itemHeight  = Mathf.Abs(p2.y - p4.y);
                            var center      = new Vector3((p1.x + p3.x) / 2, (p2.y + p4.y) / 2);
                            ChartDrawer.DrawBorder(vh, center, itemWidth, itemHeight, borderWidth, borderColor);
                        }
                    }
                }
            }
            if (dataChanging)
            {
                RefreshChart();
            }
            if (!m_Series.IsStack(serie.stack, SerieType.Bar))
            {
                m_BarLastOffset += barGapWidth;
            }
        }
Пример #10
0
        protected void DrawXBarSerie(VertexHelper vh, Serie serie, int colorIndex, ref List <float> seriesHig)
        {
            if (!IsActive(serie.index))
            {
                return;
            }
            if (serie.animation.HasFadeOut())
            {
                return;
            }
            var showData = serie.GetDataList(m_DataZoom);
            var yAxis    = m_YAxises[serie.axisIndex];
            var xAxis    = m_XAxises[serie.axisIndex];

            if (!xAxis.show)
            {
                xAxis = m_XAxises[(serie.axisIndex + 1) % m_XAxises.Count];
            }

            float categoryWidth = AxisHelper.GetDataWidth(xAxis, m_CoordinateWidth, showData.Count, m_DataZoom);
            float barGap        = GetBarGap();
            float totalBarWidth = GetBarTotalWidth(categoryWidth, barGap);
            float barWidth      = serie.GetBarWidth(categoryWidth);
            float offset        = (categoryWidth - totalBarWidth) / 2;
            float barGapWidth   = barWidth + barWidth * barGap;
            float space         = serie.barGap == -1 ? offset : offset + m_BarLastOffset;
            int   maxCount      = serie.maxShow > 0 ?
                                  (serie.maxShow > showData.Count ? showData.Count : serie.maxShow)
                : showData.Count;

            if (seriesHig.Count < serie.minShow)
            {
                for (int i = 0; i < serie.minShow; i++)
                {
                    seriesHig.Add(0);
                }
            }

            var   isPercentStack     = SeriesHelper.IsPercentStack(m_Series, serie.stack, SerieType.Bar);
            bool  dataChanging       = false;
            float dataChangeDuration = serie.animation.GetUpdateAnimationDuration();
            float yMinValue          = yAxis.GetCurrMinValue(dataChangeDuration);
            float yMaxValue          = yAxis.GetCurrMaxValue(dataChangeDuration);

            for (int i = serie.minShow; i < maxCount; i++)
            {
                if (i >= seriesHig.Count)
                {
                    seriesHig.Add(0);
                }
                var serieData = showData[i];
                if (serie.IsIgnoreValue(serieData.GetData(1)))
                {
                    serie.dataPoints.Add(Vector3.zero);
                    continue;
                }
                var highlight = (m_Tooltip.show && m_Tooltip.IsSelected(i)) ||
                                serie.data[i].highlighted ||
                                serie.highlighted;
                var   itemStyle   = SerieHelper.GetItemStyle(serie, serieData, highlight);
                float value       = serieData.GetCurrData(1, dataChangeDuration, yAxis.inverse);
                float borderWidth = value == 0 ? 0 : itemStyle.runtimeBorderWidth;
                if (serieData.IsDataChanged())
                {
                    dataChanging = true;
                }
                float pX    = m_CoordinateX + i * categoryWidth;
                float zeroY = m_CoordinateY + yAxis.runtimeZeroYOffset;
                if (!xAxis.boundaryGap)
                {
                    pX -= categoryWidth / 2;
                }
                float axisLineWidth = (value < 0 ? -1 : 1) * xAxis.axisLine.width;
                float pY            = seriesHig[i] + zeroY + axisLineWidth;

                var barHig     = 0f;
                var valueTotal = 0f;
                if (isPercentStack)
                {
                    valueTotal    = GetSameStackTotalValue(serie.stack, i);
                    barHig        = valueTotal != 0 ? (value / valueTotal * m_CoordinateHeight) : 0;
                    seriesHig[i] += barHig;
                }
                else
                {
                    valueTotal = yMaxValue - yMinValue;
                    if (valueTotal != 0)
                    {
                        barHig = (yMinValue > 0 ? value - yMinValue : value)
                                 / valueTotal * m_CoordinateHeight;
                    }
                    seriesHig[i] += barHig;
                }
                float   currHig = CheckAnimation(serie, i, barHig);
                Vector3 plb, plt, prt, prb, top;
                if (value < 0)
                {
                    plb = new Vector3(pX + space + borderWidth, pY - borderWidth);
                    plt = new Vector3(pX + space + borderWidth, pY + currHig + borderWidth - axisLineWidth);
                    prt = new Vector3(pX + space + barWidth - borderWidth, pY + currHig + borderWidth - axisLineWidth);
                    prb = new Vector3(pX + space + barWidth - borderWidth, pY - borderWidth);
                }
                else
                {
                    plb = new Vector3(pX + space + borderWidth, pY + borderWidth);
                    plt = new Vector3(pX + space + borderWidth, pY + currHig - borderWidth - axisLineWidth);
                    prt = new Vector3(pX + space + barWidth - borderWidth, pY + currHig - borderWidth - axisLineWidth);
                    prb = new Vector3(pX + space + barWidth - borderWidth, pY + borderWidth);
                }
                top = new Vector3(pX + space + barWidth / 2, pY + currHig - borderWidth);
                if (serie.clip)
                {
                    plb = ClampInCoordinate(plb);
                    plt = ClampInCoordinate(plt);
                    prt = ClampInCoordinate(prt);
                    prb = ClampInCoordinate(prb);
                    top = ClampInCoordinate(top);
                }
                serie.dataPoints.Add(top);
                if (serie.show)
                {
                    switch (serie.barType)
                    {
                    case BarType.Normal:
                        DrawNormalBar(vh, serie, serieData, itemStyle, colorIndex, highlight, space, barWidth,
                                      pX, pY, plb, plt, prt, prb, false);
                        break;

                    case BarType.Zebra:
                        DrawZebraBar(vh, serie, serieData, itemStyle, colorIndex, highlight, space, barWidth,
                                     pX, pY, plb, plt, prt, prb, false);
                        break;

                    case BarType.Capsule:
                        DrawCapsuleBar(vh, serie, serieData, itemStyle, colorIndex, highlight, space, barWidth,
                                       pX, pY, plb, plt, prt, prb, false);
                        break;
                    }
                }
            }
            if (dataChanging)
            {
                RefreshChart();
            }
            if (!SeriesHelper.IsStack(m_Series, serie.stack, SerieType.Bar))
            {
                m_BarLastOffset += barGapWidth;
            }
        }
Пример #11
0
        protected void DrawCandlestickSerie(VertexHelper vh, int colorIndex, Serie serie)
        {
            if (!IsActive(serie.index))
            {
                return;
            }
            if (serie.animation.HasFadeOut())
            {
                return;
            }
            var   showData      = serie.GetDataList(dataZoom);
            var   yAxis         = m_YAxes[serie.yAxisIndex];
            var   xAxis         = m_XAxes[serie.xAxisIndex];
            var   grid          = GetSerieGridOrDefault(serie);
            float categoryWidth = AxisHelper.GetDataWidth(xAxis, grid.runtimeWidth, showData.Count, dataZoom);
            float barWidth      = serie.GetBarWidth(categoryWidth);
            float space         = (categoryWidth - barWidth) / 2;
            int   maxCount      = serie.maxShow > 0
                ? (serie.maxShow > showData.Count ? showData.Count : serie.maxShow)
                : showData.Count;

            bool  dataChanging       = false;
            float dataChangeDuration = serie.animation.GetUpdateAnimationDuration();
            float yMinValue          = yAxis.GetCurrMinValue(dataChangeDuration);
            float yMaxValue          = yAxis.GetCurrMaxValue(dataChangeDuration);
            var   isAllBarEnd        = true;
            var   isYAxis            = false;

            for (int i = serie.minShow; i < maxCount; i++)
            {
                var serieData = showData[i];
                if (serie.IsIgnoreValue(serieData.GetData(1)))
                {
                    serie.dataPoints.Add(Vector3.zero);
                    continue;
                }
                var highlight = (tooltip.show && tooltip.IsSelected(i)) ||
                                serie.data[i].highlighted ||
                                serie.highlighted;
                var itemStyle   = SerieHelper.GetItemStyle(serie, serieData, highlight);
                var open        = serieData.GetCurrData(0, dataChangeDuration, yAxis.inverse, yMinValue, yMaxValue);
                var close       = serieData.GetCurrData(1, dataChangeDuration, yAxis.inverse, yMinValue, yMaxValue);
                var lowest      = serieData.GetCurrData(2, dataChangeDuration, yAxis.inverse, yMinValue, yMaxValue);
                var heighest    = serieData.GetCurrData(3, dataChangeDuration, yAxis.inverse, yMinValue, yMaxValue);
                var isRise      = close > open;
                var borderWidth = open == 0 ? 0f
                    : (itemStyle.runtimeBorderWidth == 0 ? m_Theme.serie.candlestickBorderWidth
                    : itemStyle.runtimeBorderWidth);
                if (serieData.IsDataChanged())
                {
                    dataChanging = true;
                }
                float pX    = grid.runtimeX + i * categoryWidth;
                float zeroY = grid.runtimeY + yAxis.runtimeZeroYOffset;
                if (!xAxis.boundaryGap)
                {
                    pX -= categoryWidth / 2;
                }
                float pY         = zeroY;
                var   barHig     = 0f;
                var   valueTotal = yMaxValue - yMinValue;
                var   minCut     = (yMinValue > 0 ? yMinValue : 0);
                if (valueTotal != 0)
                {
                    barHig = (close - open) / valueTotal * grid.runtimeHeight;
                    pY    += (open - minCut) / valueTotal * grid.runtimeHeight;
                }
                serieData.runtimeStackHig = barHig;
                var   isBarEnd = false;
                float currHig  = CheckAnimation(serie, i, barHig, out isBarEnd);
                if (!isBarEnd)
                {
                    isAllBarEnd = false;
                }
                Vector3 plb, plt, prt, prb, top;

                plb = new Vector3(pX + space + borderWidth, pY + borderWidth);
                plt = new Vector3(pX + space + borderWidth, pY + currHig - borderWidth);
                prt = new Vector3(pX + space + barWidth - borderWidth, pY + currHig - borderWidth);
                prb = new Vector3(pX + space + barWidth - borderWidth, pY + borderWidth);
                top = new Vector3(pX + space + barWidth / 2, pY + currHig - borderWidth);
                if (serie.clip)
                {
                    plb = ClampInGrid(grid, plb);
                    plt = ClampInGrid(grid, plt);
                    prt = ClampInGrid(grid, prt);
                    prb = ClampInGrid(grid, prb);
                    top = ClampInGrid(grid, top);
                }
                serie.dataPoints.Add(top);
                var areaColor = isRise
                    ? itemStyle.GetColor(m_Theme.serie.candlestickColor)
                    : itemStyle.GetColor0(m_Theme.serie.candlestickColor0);
                var borderColor = isRise
                    ? itemStyle.GetBorderColor(m_Theme.serie.candlestickBorderColor)
                    : itemStyle.GetBorderColor0(m_Theme.serie.candlestickBorderColor0);
                var itemWidth      = Mathf.Abs(prt.x - plb.x);
                var itemHeight     = Mathf.Abs(plt.y - prb.y);
                var center         = new Vector3((plb.x + prt.x) / 2, (plt.y + prb.y) / 2);
                var lowPos         = new Vector3(center.x, zeroY + (lowest - minCut) / valueTotal * grid.runtimeHeight);
                var heighPos       = new Vector3(center.x, zeroY + (heighest - minCut) / valueTotal * grid.runtimeHeight);
                var openCenterPos  = new Vector3(center.x, prb.y);
                var closeCenterPos = new Vector3(center.x, prt.y);
                if (barWidth > 2f * borderWidth)
                {
                    if (itemWidth > 0 && itemHeight > 0)
                    {
                        if (ItemStyleHelper.IsNeedCorner(itemStyle))
                        {
                            UGL.DrawRoundRectangle(vh, center, itemWidth, itemHeight, areaColor, areaColor, 0,
                                                   itemStyle.cornerRadius, isYAxis, 0.5f);
                        }
                        else
                        {
                            CheckClipAndDrawPolygon(vh, ref prb, ref plb, ref plt, ref prt, areaColor, areaColor,
                                                    serie.clip, grid);
                        }
                        UGL.DrawBorder(vh, center, itemWidth, itemHeight, 2 * borderWidth, borderColor, 0,
                                       itemStyle.cornerRadius, isYAxis, 0.5f);
                    }
                }
                else
                {
                    UGL.DrawLine(vh, openCenterPos, closeCenterPos, Mathf.Max(borderWidth, barWidth / 2), borderColor);
                }
                if (isRise)
                {
                    UGL.DrawLine(vh, openCenterPos, lowPos, borderWidth, borderColor);
                    UGL.DrawLine(vh, closeCenterPos, heighPos, borderWidth, borderColor);
                }
                else
                {
                    UGL.DrawLine(vh, closeCenterPos, lowPos, borderWidth, borderColor);
                    UGL.DrawLine(vh, openCenterPos, heighPos, borderWidth, borderColor);
                }
            }
            if (isAllBarEnd)
            {
                serie.animation.AllBarEnd();
            }
            if (dataChanging)
            {
                RefreshPainter(serie);
            }
        }
Пример #12
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();
            }
        }
Пример #13
0
        private void DrawSerieData(VertexHelper vh, Grid grid, Serie serie, SerieData serieData, int colorIndex,
                                   float pX, float pY, float space, float barWidth, bool isTime, float minValue, float maxValue,
                                   float xCategoryWidth)
        {
            var xStart       = 0f;
            var xEnd         = 0f;
            var xActualStart = 0f;
            var xActualEnd   = 0f;
            var start        = (int)serieData.GetData(0);
            var end          = (int)serieData.GetData(1);
            var actualStart  = (int)serieData.GetData(2);
            var actualEnd    = (int)serieData.GetData(3);
            var enableActual = actualStart > 0 && actualEnd > 0;

            if (isTime)
            {
                var valueTotal = maxValue - minValue;
                xStart = pX + (start - minValue) / valueTotal * grid.runtimeWidth;
                xEnd   = pX + (end - minValue) / valueTotal * grid.runtimeWidth;
                if (enableActual)
                {
                    xActualStart = pX + (actualStart - minValue) / valueTotal * grid.runtimeWidth;
                    xActualEnd   = pX + (actualEnd - minValue) / valueTotal * grid.runtimeWidth;
                }
            }
            else
            {
                xStart = pX + start * xCategoryWidth;
                xEnd   = pX + end * xCategoryWidth;
                if (enableActual)
                {
                    xActualStart = pX + actualStart * xCategoryWidth;
                    xActualEnd   = pX + actualEnd * xCategoryWidth;
                }
            }
            var highlight = (serieData != null && serieData.highlighted) ||
                            serie.highlighted;
            var itemStyle   = SerieHelper.GetItemStyle(serie, serieData, highlight);
            var color       = SerieHelper.GetItemColor(serie, serieData, m_Theme, colorIndex, highlight);
            var borderWidth = itemStyle.borderWidth;

            var rect = DrawGanttBar(vh, grid, serie, serieData, itemStyle, color, pY, pY, space, barWidth, xStart,
                                    xEnd);

            if (enableActual)
            {
                var defaultActualColor = SerieHelper.GetItemColor(serie, serieData, m_Theme, colorIndex, true);
                var actualColor        = SerieHelper.GetItemColor0(serie, serieData, m_Theme, highlight, defaultActualColor);
                var rect2 = DrawGanttBar(vh, grid, serie, serieData, itemStyle, actualColor, pY, pY, space, barWidth,
                                         xActualStart, xActualEnd);
                var rect3X     = Mathf.Min(rect.x, rect2.x);
                var rect3Width = Mathf.Max(rect.x + rect.width, rect2.x + rect2.width) - rect3X;
                var rect3      = new Rect(rect3X, rect.y, rect3Width, rect.height);
                serie.dataPoints.Add(rect3.center);
                serieData.runtimePosition = rect3.center;
                serieData.labelPosition   = rect3.center;
                serieData.runtimeRect     = rect3;
            }
            else
            {
                serie.dataPoints.Add(rect.center);
                serieData.runtimePosition = rect.center;
                serieData.labelPosition   = rect.center;
                serieData.runtimeRect     = rect;
            }
        }
Пример #14
0
        private void DrawPie(VertexHelper vh)
        {
            bool isClickOffset   = false;
            bool isDataHighlight = false;

            for (int i = 0; i < m_Series.Count; i++)
            {
                var serie = m_Series.list[i];
                serie.index = i;
                var data = serie.data;
                serie.animation.InitProgress(data.Count, 0, 360);
                if (!serie.show || serie.animation.HasFadeOut())
                {
                    continue;
                }
                if (serie.pieClickOffset)
                {
                    isClickOffset = true;
                }
                bool dataChanging = false;
                for (int n = 0; n < data.Count; n++)
                {
                    var serieData = data[n];
                    if (!serieData.show)
                    {
                        continue;
                    }
                    var itemStyle = SerieHelper.GetItemStyle(serie, serieData, serieData.highlighted);
                    if (serieData.IsDataChanged())
                    {
                        dataChanging = true;
                    }
                    var serieNameCount = m_LegendRealShowName.IndexOf(serieData.legendName);
                    var color          = SerieHelper.GetItemColor(serie, serieData, m_ThemeInfo, serieNameCount, serieData.highlighted);
                    var toColor        = SerieHelper.GetItemToColor(serie, serieData, m_ThemeInfo, serieNameCount, serieData.highlighted);
                    var borderWidth    = itemStyle.borderWidth;
                    var borderColor    = itemStyle.borderColor;

                    if (serieData.highlighted)
                    {
                        isDataHighlight = true;
                    }
                    if (serie.pieClickOffset && serieData.selected)
                    {
                        var drawEndDegree = serieData.runtimePieCurrAngle;
                        var needRoundCap  = serie.roundCap && serieData.runtimePieInsideRadius > 0;
                        ChartDrawer.DrawDoughnut(vh, serieData.runtiemPieOffsetCenter, serieData.runtimePieInsideRadius,
                                                 serieData.runtimePieOutsideRadius, color, toColor, Color.clear, serieData.runtimePieStartAngle, drawEndDegree,
                                                 borderWidth, borderColor, serie.pieSpace / 2, m_Settings.cicleSmoothness, needRoundCap, true);
                    }
                    else
                    {
                        var drawEndDegree = serieData.runtimePieCurrAngle;
                        var needRoundCap  = serie.roundCap && serieData.runtimePieInsideRadius > 0;
                        ChartDrawer.DrawDoughnut(vh, serie.runtimeCenterPos, serieData.runtimePieInsideRadius, serieData.runtimePieOutsideRadius,
                                                 color, toColor, Color.clear, serieData.runtimePieStartAngle, drawEndDegree, borderWidth, borderColor, serie.pieSpace / 2,
                                                 m_Settings.cicleSmoothness, needRoundCap, true);
                        DrawCenter(vh, serie, itemStyle, serieData.runtimePieInsideRadius);
                    }
                    isDrawPie = true;
                    if (!serie.animation.CheckDetailBreak(serieData.runtimePieToAngle))
                    {
                        serie.animation.SetDataFinish(n);
                    }
                    else
                    {
                        break;
                    }
                }
                if (!serie.animation.IsFinish())
                {
                    serie.animation.CheckProgress(360);
                    serie.animation.CheckSymbol(serie.symbol.size);
                    RefreshChart();
                }
                if (dataChanging)
                {
                    RefreshChart();
                }
            }
            raycastTarget = isClickOffset && isDataHighlight;
        }
Пример #15
0
        private void UpdateRuntimeData()
        {
            for (int i = 0; i < m_Series.Count; i++)
            {
                var serie = m_Series.list[i];
                if (serie.type != SerieType.Pie)
                {
                    continue;
                }
                serie.index = i;
                var data = serie.data;
                serie.runtimeDataMax      = serie.yMax;
                serie.runtimePieDataTotal = serie.yTotal;
                serie.animation.InitProgress(data.Count, 0, 360);
                SerieHelper.UpdateCenter(serie, chartPosition, chartWidth, chartHeight);
                float totalDegree   = 360f;
                float startDegree   = 0;
                int   showdataCount = 0;
                foreach (var sd in serie.data)
                {
                    if (sd.show && serie.pieRoseType == RoseType.Area)
                    {
                        showdataCount++;
                    }
                    sd.canShowLabel = false;
                }
                float dataChangeDuration = serie.animation.GetUpdateAnimationDuration();
                bool  isAllZeroValue     = SerieHelper.IsAllZeroValue(serie, 1);
                float zeroReplaceValue   = totalDegree / data.Count;
                if (isAllZeroValue)
                {
                    serie.runtimeDataMax      = zeroReplaceValue;
                    serie.runtimePieDataTotal = totalDegree;
                }
                for (int n = 0; n < data.Count; n++)
                {
                    var serieData = data[n];
                    var itemStyle = SerieHelper.GetItemStyle(serie, serieData, serieData.highlighted);
                    serieData.index = n;
                    float value = isAllZeroValue ? zeroReplaceValue : serieData.GetCurrData(1, dataChangeDuration);
                    serieData.runtimePieStartAngle = startDegree;
                    serieData.runtimePieToAngle    = startDegree;
                    serieData.runtimePieHalfAngle  = startDegree;
                    serieData.runtimePieCurrAngle  = startDegree;
                    if (!serieData.show)
                    {
                        continue;
                    }
                    float degree = serie.pieRoseType == RoseType.Area ?
                                   (totalDegree / showdataCount) : (totalDegree * value / serie.runtimePieDataTotal);
                    serieData.runtimePieToAngle = startDegree + degree;

                    serieData.runtimePieOutsideRadius = serie.pieRoseType > 0 ?
                                                        serie.runtimeInsideRadius + (serie.runtimeOutsideRadius - serie.runtimeInsideRadius) * value / serie.runtimeDataMax :
                                                        serie.runtimeOutsideRadius;
                    if (serieData.highlighted)
                    {
                        serieData.runtimePieOutsideRadius += m_Settings.pieTooltipExtraRadius;
                    }
                    var offset = 0f;
                    if (serie.pieClickOffset && serieData.selected)
                    {
                        offset += m_Settings.pieSelectedOffset;
                    }
                    if (serie.animation.CheckDetailBreak(serieData.runtimePieToAngle))
                    {
                        serieData.runtimePieCurrAngle = serie.animation.GetCurrDetail();
                    }
                    else
                    {
                        serieData.runtimePieCurrAngle = serieData.runtimePieToAngle;
                    }
                    var halfDegree = (serieData.runtimePieToAngle - startDegree) / 2;
                    serieData.runtimePieHalfAngle    = startDegree + halfDegree;
                    serieData.runtiemPieOffsetCenter = serie.runtimeCenterPos;
                    serieData.runtimePieInsideRadius = serie.runtimeInsideRadius;
                    if (offset > 0)
                    {
                        var currRad = serieData.runtimePieHalfAngle * Mathf.Deg2Rad;
                        var currSin = Mathf.Sin(currRad);
                        var currCos = Mathf.Cos(currRad);
                        serieData.runtimePieOffsetRadius   = 0;
                        serieData.runtimePieInsideRadius  -= serieData.runtimePieOffsetRadius;
                        serieData.runtimePieOutsideRadius -= serieData.runtimePieOffsetRadius;
                        if (serie.pieClickOffset && serieData.selected)
                        {
                            serieData.runtimePieOffsetRadius += m_Settings.pieSelectedOffset;
                            if (serieData.runtimePieInsideRadius > 0)
                            {
                                serieData.runtimePieInsideRadius += m_Settings.pieSelectedOffset;
                            }
                            serieData.runtimePieOutsideRadius += m_Settings.pieSelectedOffset;
                        }
                        serieData.runtiemPieOffsetCenter = new Vector3(serie.runtimeCenterPos.x + serieData.runtimePieOffsetRadius * currSin,
                                                                       serie.runtimeCenterPos.y + serieData.runtimePieOffsetRadius * currCos);
                    }
                    serieData.canShowLabel = serieData.runtimePieCurrAngle >= serieData.runtimePieHalfAngle;
                    startDegree            = serieData.runtimePieToAngle;
                    SerieLabelHelper.UpdatePieLabelPosition(serie, serieData);
                }
                SerieLabelHelper.AvoidLabelOverlap(serie);
            }
        }