private void DrawPolarLineSymbol(VertexHelper vh)
        {
            for (int n = 0; n < chart.series.Count; n++)
            {
                var serie = chart.series[n];

                if (!serie.show)
                {
                    continue;
                }
                if (!(serie is Line))
                {
                    continue;
                }

                var count = serie.dataCount;
                for (int i = 0; i < count; i++)
                {
                    var serieData = serie.GetSerieData(i);
                    var symbol    = SerieHelper.GetSerieSymbol(serie, serieData);
                    if (ChartHelper.IsIngore(serieData.context.position))
                    {
                        continue;
                    }

                    bool highlight = serieData.context.highlight || serie.highlight;
                    if ((!symbol.show || !symbol.ShowSymbol(i, count) || serie.IsPerformanceMode()) &&
                        !serieData.context.highlight)
                    {
                        continue;
                    }

                    var symbolSize = highlight ?
                                     symbol.GetSelectedSize(serieData.data, chart.theme.serie.lineSymbolSize) :
                                     symbol.GetSize(serieData.data, chart.theme.serie.lineSymbolSize);

                    var symbolColor      = SerieHelper.GetItemColor(serie, serieData, chart.theme, n, highlight);
                    var symbolToColor    = SerieHelper.GetItemToColor(serie, serieData, chart.theme, n, highlight);
                    var symbolEmptyColor = SerieHelper.GetItemBackgroundColor(serie, serieData, chart.theme, n, highlight, false);
                    var symbolBorder     = SerieHelper.GetSymbolBorder(serie, serieData, chart.theme, highlight);
                    var borderColor      = SerieHelper.GetSymbolBorderColor(serie, serieData, chart.theme, highlight);
                    var cornerRadius     = SerieHelper.GetSymbolCornerRadius(serie, serieData, highlight);

                    symbolSize = serie.animation.GetSysmbolSize(symbolSize);
                    chart.DrawSymbol(vh, symbol.type, symbolSize, symbolBorder, serieData.context.position,
                                     symbolColor, symbolToColor, symbolEmptyColor, borderColor, symbol.gap, cornerRadius);
                }
            }
        }
        private void UpdateSerieContext()
        {
            var needCheck = m_LegendEnter || (chart.isPointerInChart && (m_Grid == null || m_Grid.IsPointerEnter()));

            var needHideAll = false;

            if (!needCheck)
            {
                if (m_LastCheckContextFlag == needCheck)
                {
                    return;
                }
                needHideAll = true;
            }
            m_LastCheckContextFlag             = needCheck;
            serie.context.pointerItemDataIndex = -1;
            serie.context.pointerEnter         = false;
            var themeSymbolSize         = chart.theme.serie.scatterSymbolSize;
            var themeSymbolSelectedSize = chart.theme.serie.scatterSymbolSelectedSize;
            var needInteract            = false;

            for (int i = serie.dataCount - 1; i >= 0; i--)
            {
                var serieData          = serie.data[i];
                var symbol             = SerieHelper.GetSerieSymbol(serie, serieData);
                var symbolSize         = symbol.GetSize(serieData.data, themeSymbolSize);
                var symbolSelectedSize = symbol.GetSelectedSize(serieData.data, themeSymbolSelectedSize);
                if (m_LegendEnter ||
                    (!needHideAll && Vector3.Distance(serieData.context.position, chart.pointerPos) <= symbolSize))
                {
                    serie.context.pointerItemDataIndex = i;
                    serie.context.pointerEnter         = true;
                    serieData.context.highlight        = true;
                    serieData.interact.SetValue(ref needInteract, symbolSelectedSize);
                }
                else
                {
                    serieData.context.highlight = false;
                    serieData.interact.SetValue(ref needInteract, symbolSize);
                }
            }
            if (needInteract)
            {
                chart.RefreshPainter(serie);
            }
        }
        private void UpdateSeriePolarContext()
        {
            if (m_SeriePolar == null)
            {
                return;
            }

            var needCheck = (chart.isPointerInChart && m_SeriePolar.IsPointerEnter()) || m_LegendEnter;
            var lineWidth = 0f;

            if (!needCheck)
            {
                if (m_LastCheckContextFlag != needCheck)
                {
                    var needAnimation1 = false;
                    lineWidth = serie.lineStyle.GetWidth(chart.theme.serie.lineWidth);
                    m_LastCheckContextFlag             = needCheck;
                    serie.context.pointerItemDataIndex = -1;
                    serie.context.pointerEnter         = false;
                    serie.interact.SetValue(ref needAnimation1, lineWidth, false);
                    foreach (var serieData in serie.data)
                    {
                        var symbol     = SerieHelper.GetSerieSymbol(serie, serieData);
                        var symbolSize = symbol.GetSize(serieData.data, chart.theme.serie.lineSymbolSize);
                        serieData.context.highlight = false;
                        serieData.interact.SetValue(ref needAnimation1, symbolSize);
                    }
                    if (needAnimation1)
                    {
                        if (SeriesHelper.IsStack(chart.series))
                        {
                            chart.RefreshTopPainter();
                        }
                        else
                        {
                            chart.RefreshPainter(serie);
                        }
                    }
                }
                return;
            }
            m_LastCheckContextFlag = needCheck;
            var themeSymbolSize         = chart.theme.serie.lineSymbolSize;
            var themeSymbolSelectedSize = chart.theme.serie.lineSymbolSelectedSize;

            lineWidth = serie.lineStyle.GetWidth(chart.theme.serie.lineWidth);

            var needInteract = false;

            if (m_LegendEnter)
            {
                serie.interact.SetValue(ref needInteract, lineWidth, true, chart.theme.serie.selectedRate);
                for (int i = 0; i < serie.dataCount; i++)
                {
                    var serieData          = serie.data[i];
                    var symbol             = SerieHelper.GetSerieSymbol(serie, serieData);
                    var symbolSelectedSize = symbol.GetSelectedSize(serieData.data, themeSymbolSelectedSize);

                    serieData.context.highlight = true;
                    serieData.interact.SetValue(ref needInteract, symbolSelectedSize);
                }
            }
            else
            {
                serie.context.pointerItemDataIndex = -1;
                serie.context.pointerEnter         = false;
                var dir          = chart.pointerPos - new Vector2(m_SeriePolar.context.center.x, m_SeriePolar.context.center.y);
                var pointerAngle = ChartHelper.GetAngle360(Vector2.up, dir);
                for (int i = 0; i < serie.dataCount; i++)
                {
                    var serieData = serie.data[i];
                    var angle0    = serieData.context.angle;
                    var angle1    = i >= serie.dataCount - 1 ? angle0 : serie.data[i + 1].context.angle;

                    if (pointerAngle >= angle0 && pointerAngle < angle1)
                    {
                        serie.context.pointerItemDataIndex = i;
                        serie.context.pointerEnter         = true;
                        serieData.context.highlight        = true;
                    }
                    else
                    {
                        serieData.context.highlight = false;
                    }
                }
            }
            if (needInteract)
            {
                if (SeriesHelper.IsStack(chart.series))
                {
                    chart.RefreshTopPainter();
                }
                else
                {
                    chart.RefreshPainter(serie);
                }
            }
        }
示例#4
0
        private void UpdateSerieGridContext()
        {
            if (m_SerieGrid == null)
            {
                return;
            }
            var lineWidth = serie.lineStyle.GetWidth(chart.theme.serie.lineWidth);
            var needCheck = (chart.isPointerInChart && m_SerieGrid.IsPointerEnter()) || m_LegendEnter;

            if (!needCheck)
            {
                if (m_LastCheckContextFlag != needCheck)
                {
                    m_LastCheckContextFlag             = needCheck;
                    serie.context.pointerItemDataIndex = -1;
                    serie.context.pointerEnter         = false;
                    serie.highlight = false;
                    serie.ResetInteract();
                    foreach (var serieData in serie.data)
                    {
                        serieData.context.highlight = false;
                    }
                    if (SeriesHelper.IsStack(chart.series))
                    {
                        chart.RefreshTopPainter();
                    }
                    else
                    {
                        chart.RefreshPainter(serie);
                    }
                }
                return;
            }
            m_LastCheckContextFlag = needCheck;
            var themeSymbolSize         = chart.theme.serie.lineSymbolSize;
            var themeSymbolSelectedSize = chart.theme.serie.lineSymbolSelectedSize;
            var needInteract            = false;

            if (m_LegendEnter)
            {
                serie.interact.SetValue(ref needInteract, lineWidth, true, chart.theme.serie.selectedRate);
                for (int i = 0; i < serie.dataCount; i++)
                {
                    var serieData          = serie.data[i];
                    var symbol             = SerieHelper.GetSerieSymbol(serie, serieData);
                    var symbolSelectedSize = symbol.GetSelectedSize(serieData.data, themeSymbolSelectedSize);

                    serieData.context.highlight = true;
                    serieData.interact.SetValue(ref needInteract, symbolSelectedSize);
                }
            }
            else if (serie.context.isTriggerByAxis)
            {
                serie.context.pointerEnter = true;
                serie.interact.SetValue(ref needInteract, lineWidth, true, chart.theme.serie.selectedRate);
                for (int i = 0; i < serie.dataCount; i++)
                {
                    var serieData          = serie.data[i];
                    var symbol             = SerieHelper.GetSerieSymbol(serie, serieData);
                    var symbolSize         = symbol.GetSize(serieData.data, themeSymbolSize);
                    var symbolSelectedSize = symbol.GetSelectedSize(serieData.data, themeSymbolSelectedSize);

                    if (i == serie.context.pointerItemDataIndex)
                    {
                        serieData.context.highlight = true;
                        serieData.interact.SetValue(ref needInteract, symbolSelectedSize);
                    }
                    else
                    {
                        serieData.context.highlight = false;
                        serieData.interact.SetValue(ref needInteract, symbolSize);
                    }
                }
            }
            else
            {
                serie.context.pointerItemDataIndex = -1;
                serie.context.pointerEnter         = false;
                for (int i = 0; i < serie.dataCount; i++)
                {
                    var serieData = serie.data[i];
                    serieData.index = i;
                    var dist               = Vector3.Distance(chart.pointerPos, serieData.context.position);
                    var symbol             = SerieHelper.GetSerieSymbol(serie, serieData);
                    var symbolSize         = symbol.GetSize(serieData.data, themeSymbolSize);
                    var symbolSelectedSize = symbol.GetSelectedSize(serieData.data, themeSymbolSelectedSize);
                    if (dist <= symbolSelectedSize)
                    {
                        serie.context.pointerItemDataIndex = serieData.index;
                        serie.context.pointerEnter         = true;
                        serie.interact.SetValue(ref needInteract, lineWidth, true);
                        serieData.context.highlight = true;
                        serieData.interact.SetValue(ref needInteract, symbolSelectedSize);
                    }
                    else
                    {
                        serieData.context.highlight = false;
                        serieData.interact.SetValue(ref needInteract, symbolSize);
                    }
                }
            }
            if (needInteract)
            {
                if (SeriesHelper.IsStack(chart.series))
                {
                    chart.RefreshTopPainter();
                }
                else
                {
                    chart.RefreshPainter(serie);
                }
            }
        }
示例#5
0
        private void DrawLinePoint(VertexHelper vh, Serie serie)
        {
            if (!serie.show || serie.IsPerformanceMode())
            {
                return;
            }

            if (m_SerieGrid == null)
            {
                return;
            }

            var count               = serie.context.dataPoints.Count;
            var clip                = SeriesHelper.IsAnyClipSerie(chart.series);
            var theme               = chart.theme;
            var interacting         = false;
            var lineArrow           = serie.lineArrow;
            var visualMap           = chart.GetVisualMapOfSerie(serie);
            var isVisualMapGradient = VisualMapHelper.IsNeedLineGradient(visualMap);

            Axis axis;
            Axis relativedAxis;
            var  isY = chart.GetSerieGridCoordAxis(serie, out axis, out relativedAxis);

            for (int i = 0; i < count; i++)
            {
                var serieData = serie.GetSerieData(i);
                if (serieData == null)
                {
                    continue;
                }
                if (serieData.context.isClip)
                {
                    continue;
                }

                var symbol = SerieHelper.GetSerieSymbol(serie, serieData);

                if (!symbol.show || !symbol.ShowSymbol(i, count))
                {
                    continue;
                }

                var pos = serie.context.dataPoints[i];
                if (lineArrow != null && lineArrow.show)
                {
                    if (lineArrow.position == LineArrow.Position.Start && i == 0)
                    {
                        continue;
                    }
                    if (lineArrow.position == LineArrow.Position.End && i == count - 1)
                    {
                        continue;
                    }
                }

                if (ChartHelper.IsIngore(pos))
                {
                    continue;
                }

                var highlight  = serie.data[i].context.highlight || serie.highlight;
                var symbolSize = highlight ?
                                 theme.serie.lineSymbolSelectedSize :
                                 theme.serie.lineSymbolSize;
                if (!serieData.interact.TryGetValue(ref symbolSize, ref interacting))
                {
                    symbolSize = highlight ?
                                 symbol.GetSelectedSize(serieData.data, symbolSize) :
                                 symbol.GetSize(serieData.data, symbolSize);
                    serieData.interact.SetValue(ref interacting, symbolSize);
                    symbolSize = serie.animation.GetSysmbolSize(symbolSize);
                }
                var symbolColor      = SerieHelper.GetItemColor(serie, serieData, theme, serie.index, highlight);
                var symbolToColor    = SerieHelper.GetItemToColor(serie, serieData, theme, serie.index, highlight);
                var symbolEmptyColor = SerieHelper.GetItemBackgroundColor(serie, serieData, theme, serie.index, highlight, false);

                if (isVisualMapGradient)
                {
                    symbolColor   = VisualMapHelper.GetLineGradientColor(visualMap, pos, m_SerieGrid, axis, relativedAxis, symbolColor);
                    symbolToColor = symbolColor;
                }
                var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, theme, highlight);
                var borderColor  = SerieHelper.GetSymbolBorderColor(serie, serieData, theme, highlight);
                var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, highlight);
                chart.DrawClipSymbol(vh, symbol.type, symbolSize, symbolBorder, pos,
                                     symbolColor, symbolToColor, symbolEmptyColor, borderColor, symbol.gap, clip, cornerRadius, m_SerieGrid,
                                     i > 0 ? serie.context.dataPoints[i - 1] : m_SerieGrid.context.position);
            }
            if (interacting)
            {
                if (SeriesHelper.IsStack(chart.series))
                {
                    chart.RefreshTopPainter();
                }
                else
                {
                    chart.RefreshPainter(serie);
                }
            }
        }
        protected virtual void DrawSingAxisScatterSerie(VertexHelper vh, BaseScatter serie)
        {
            if (serie.animation.HasFadeOut())
            {
                return;
            }

            if (!serie.show)
            {
                return;
            }

            var axis = chart.GetChartComponent <SingleAxis>(serie.singleAxisIndex);

            if (axis == null)
            {
                return;
            }

            DataZoom xDataZoom;
            DataZoom yDataZoom;

            chart.GetDataZoomOfSerie(serie, out xDataZoom, out yDataZoom);

            var theme    = chart.theme;
            int maxCount = serie.maxShow > 0 ?
                           (serie.maxShow > serie.dataCount ? serie.dataCount : serie.maxShow) :
                           serie.dataCount;

            serie.animation.InitProgress(0, 1);

            var rate = serie.animation.GetCurrRate();
            var dataChangeDuration = serie.animation.GetUpdateAnimationDuration();
            var dataChanging       = false;
            var dataList           = serie.GetDataList(xDataZoom);
            var isEffectScatter    = serie is EffectScatter;
            var colorIndex         = serie.context.colorIndex;

            serie.containerIndex       = axis.index;
            serie.containterInstanceId = axis.instanceId;

            foreach (var serieData in dataList)
            {
                var symbol = SerieHelper.GetSerieSymbol(serie, serieData);
                if (!symbol.ShowSymbol(serieData.index, maxCount))
                {
                    continue;
                }

                var highlight    = serie.highlight || serieData.context.highlight;
                var color        = SerieHelper.GetItemColor(serie, serieData, theme, colorIndex, highlight);
                var toColor      = SerieHelper.GetItemToColor(serie, serieData, theme, colorIndex, highlight);
                var emptyColor   = SerieHelper.GetItemBackgroundColor(serie, serieData, theme, colorIndex, highlight, false);
                var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, theme, highlight);
                var borderColor  = SerieHelper.GetSymbolBorderColor(serie, serieData, theme, highlight);
                var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, highlight);
                var xValue       = serieData.GetCurrData(0, dataChangeDuration, axis.inverse);

                if (serieData.IsDataChanged())
                {
                    dataChanging = true;
                }

                var pos = Vector3.zero;
                if (axis.orient == Orient.Horizonal)
                {
                    var xDataHig = GetDataHig(axis, xValue, axis.context.width);
                    var yDataHig = axis.context.height / 2;
                    pos = new Vector3(axis.context.x + xDataHig, axis.context.y + yDataHig);
                }
                else
                {
                    var yDataHig = GetDataHig(axis, xValue, axis.context.width);
                    var xDataHig = axis.context.height / 2;
                    pos = new Vector3(axis.context.x + xDataHig, axis.context.y + yDataHig);
                }
                serie.context.dataPoints.Add(pos);
                serieData.context.position = pos;

                var datas      = serieData.data;
                var symbolSize = 0f;
                if (serie.highlight || serieData.context.highlight)
                {
                    symbolSize = symbol.GetSelectedSize(datas, theme.serie.scatterSymbolSelectedSize);
                }
                else
                {
                    symbolSize = symbol.GetSize(datas, theme.serie.scatterSymbolSize);
                }
                symbolSize *= rate;

                if (isEffectScatter)
                {
                    if (symbolSize > 100)
                    {
                        symbolSize = 100;
                    }
                    for (int count = 0; count < symbol.animationSize.Count; count++)
                    {
                        var nowSize = symbol.animationSize[count];
                        color.a = (byte)(255 * (symbolSize - nowSize) / symbolSize);
                        chart.DrawSymbol(vh, symbol.type, nowSize, symbolBorder, pos,
                                         color, toColor, emptyColor, borderColor, symbol.gap, cornerRadius);
                    }
                    chart.RefreshPainter(serie);
                }
                else
                {
                    if (symbolSize > 100)
                    {
                        symbolSize = 100;
                    }
                    chart.DrawSymbol(vh, symbol.type, symbolSize, symbolBorder, pos,
                                     color, toColor, emptyColor, borderColor, symbol.gap, cornerRadius);
                }
            }
            if (!serie.animation.IsFinish())
            {
                serie.animation.CheckProgress(1);
                chart.RefreshPainter(serie);
            }
            if (dataChanging)
            {
                chart.RefreshPainter(serie);
            }
        }
        protected virtual void DrawScatterSerie(VertexHelper vh, BaseScatter serie)
        {
            if (serie.animation.HasFadeOut())
            {
                return;
            }

            if (!serie.show)
            {
                return;
            }

            XAxis xAxis;

            if (!chart.TryGetChartComponent <XAxis>(out xAxis, serie.xAxisIndex))
            {
                return;
            }

            YAxis yAxis;

            if (!chart.TryGetChartComponent <YAxis>(out yAxis, serie.yAxisIndex))
            {
                return;
            }

            if (!chart.TryGetChartComponent <GridCoord>(out m_Grid, xAxis.gridIndex))
            {
                return;
            }

            DataZoom xDataZoom;
            DataZoom yDataZoom;

            chart.GetDataZoomOfSerie(serie, out xDataZoom, out yDataZoom);

            var theme    = chart.theme;
            int maxCount = serie.maxShow > 0 ?
                           (serie.maxShow > serie.dataCount ? serie.dataCount : serie.maxShow) :
                           serie.dataCount;

            serie.animation.InitProgress(0, 1);
            var rate = serie.animation.GetCurrRate();
            var dataChangeDuration = serie.animation.GetUpdateAnimationDuration();
            var dataChanging       = false;
            var interacting        = false;
            var dataList           = serie.GetDataList(xDataZoom);
            var isEffectScatter    = serie is EffectScatter;
            var colorIndex         = serie.context.colorIndex;

            serie.containerIndex       = m_Grid.index;
            serie.containterInstanceId = m_Grid.instanceId;

            foreach (var serieData in dataList)
            {
                var symbol = SerieHelper.GetSerieSymbol(serie, serieData);
                if (!symbol.ShowSymbol(serieData.index, maxCount))
                {
                    continue;
                }

                var    highlight    = serie.highlight || serieData.context.highlight;
                var    color        = SerieHelper.GetItemColor(serie, serieData, theme, colorIndex, highlight);
                var    toColor      = SerieHelper.GetItemToColor(serie, serieData, theme, colorIndex, highlight);
                var    emptyColor   = SerieHelper.GetItemBackgroundColor(serie, serieData, theme, colorIndex, highlight, false);
                var    symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, theme, highlight);
                var    borderColor  = SerieHelper.GetSymbolBorderColor(serie, serieData, theme, highlight);
                var    cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, highlight);
                double xValue       = serieData.GetCurrData(0, dataChangeDuration, xAxis.inverse);
                double yValue       = serieData.GetCurrData(1, dataChangeDuration, yAxis.inverse);

                if (serieData.IsDataChanged())
                {
                    dataChanging = true;
                }

                float pX       = m_Grid.context.x + xAxis.axisLine.GetWidth(theme.axis.lineWidth);
                float pY       = m_Grid.context.y + yAxis.axisLine.GetWidth(theme.axis.lineWidth);
                float xDataHig = GetDataHig(xAxis, xValue, m_Grid.context.width);
                float yDataHig = GetDataHig(yAxis, yValue, m_Grid.context.height);
                var   pos      = new Vector3(pX + xDataHig, pY + yDataHig);

                if (!m_Grid.Contains(pos))
                {
                    continue;
                }

                serie.context.dataPoints.Add(pos);
                serieData.context.position = pos;
                var datas      = serieData.data;
                var symbolSize = serie.highlight || serieData.context.highlight ?
                                 theme.serie.scatterSymbolSelectedSize :
                                 theme.serie.scatterSymbolSize;
                if (!serieData.interact.TryGetValue(ref symbolSize, ref interacting))
                {
                    symbolSize = highlight ?
                                 symbol.GetSelectedSize(serieData.data, symbolSize) :
                                 symbol.GetSize(serieData.data, symbolSize);
                    serieData.interact.SetValue(ref interacting, symbolSize);
                }

                symbolSize *= rate;

                if (isEffectScatter)
                {
                    for (int count = 0; count < symbol.animationSize.Count; count++)
                    {
                        var nowSize = symbol.animationSize[count];
                        color.a = (byte)(255 * (symbolSize - nowSize) / symbolSize);
                        chart.DrawSymbol(vh, symbol.type, nowSize, symbolBorder, pos,
                                         color, toColor, emptyColor, borderColor, symbol.gap, cornerRadius);
                    }
                    chart.RefreshPainter(serie);
                }
                else
                {
                    if (symbolSize > 100)
                    {
                        symbolSize = 100;
                    }
                    chart.DrawSymbol(vh, symbol.type, symbolSize, symbolBorder, pos,
                                     color, toColor, emptyColor, borderColor, symbol.gap, cornerRadius);
                }
            }
            if (!serie.animation.IsFinish())
            {
                serie.animation.CheckProgress(1);
                chart.RefreshPainter(serie);
            }
            if (dataChanging || interacting)
            {
                chart.RefreshPainter(serie);
            }
        }
        private void DrawMutipleRadar(VertexHelper vh)
        {
            if (!serie.show)
            {
                return;
            }
            m_RadarCoord = chart.GetChartComponent <RadarCoord>(serie.radarIndex);
            if (m_RadarCoord == null)
            {
                return;
            }

            serie.containerIndex       = m_RadarCoord.index;
            serie.containterInstanceId = m_RadarCoord.instanceId;

            var startPoint   = Vector3.zero;
            var toPoint      = Vector3.zero;
            var firstPoint   = Vector3.zero;
            var indicatorNum = m_RadarCoord.indicatorList.Count;
            var angle        = 2 * Mathf.PI / indicatorNum;
            var centerPos    = m_RadarCoord.context.center;

            serie.animation.InitProgress(0, 1);
            if (!serie.show || serie.animation.HasFadeOut())
            {
                return;
            }
            var rate               = serie.animation.GetCurrRate();
            var dataChanging       = false;
            var interacting        = false;
            var dataChangeDuration = serie.animation.GetUpdateAnimationDuration();

            SerieHelper.GetAllMinMaxData(serie, m_RadarCoord.ceilRate);
            for (int j = 0; j < serie.data.Count; j++)
            {
                var    serieData = serie.data[j];
                string dataName  = serieData.name;
                if (!serieData.show)
                {
                    continue;
                }
                var lineStyle   = SerieHelper.GetLineStyle(serie, serieData);
                var areaStyle   = SerieHelper.GetAreaStyle(serie, serieData);
                var symbol      = SerieHelper.GetSerieSymbol(serie, serieData);
                var isHighlight = serieData.context.highlight;
                var colorIndex  = chart.GetLegendRealShowNameIndex(serieData.legendName);
                var areaColor   = SerieHelper.GetAreaColor(serie, serieData, chart.theme, colorIndex, isHighlight);
                var areaToColor = SerieHelper.GetAreaToColor(serie, serieData, chart.theme, colorIndex, isHighlight);
                var lineColor   = SerieHelper.GetLineColor(serie, serieData, chart.theme, colorIndex, isHighlight);
                var lineWidth   = lineStyle.GetWidth(chart.theme.serie.lineWidth);
                int dataCount   = m_RadarCoord.indicatorList.Count;
                serieData.context.dataPoints.Clear();
                for (int n = 0; n < dataCount; n++)
                {
                    if (n >= serieData.data.Count)
                    {
                        break;
                    }
                    var min   = m_RadarCoord.GetIndicatorMin(n);
                    var max   = m_RadarCoord.GetIndicatorMax(n);
                    var value = serieData.GetCurrData(n, dataChangeDuration);
                    if (serieData.IsDataChanged())
                    {
                        dataChanging = true;
                    }
                    if (max == 0)
                    {
                        if (serie.data.Count > 1)
                        {
                            SerieHelper.GetMinMaxData(serie, n, out min, out max);
                            min = ChartHelper.GetMinDivisibleValue(min, 0);
                            max = ChartHelper.GetMaxDivisibleValue(max, 0);
                            if (min > 0)
                            {
                                min = 0;
                            }
                        }
                        else
                        {
                            max = serie.context.dataMax;
                        }
                    }
                    var radius    = (float)(m_RadarCoord.context.dataRadius * (value - min) / (max - min));
                    var currAngle = (n + (m_RadarCoord.positionType == RadarCoord.PositionType.Between ? 0.5f : 0)) * angle;
                    radius *= rate;
                    if (n == 0)
                    {
                        startPoint = new Vector3(centerPos.x + radius * Mathf.Sin(currAngle),
                                                 centerPos.y + radius * Mathf.Cos(currAngle));
                        firstPoint = startPoint;
                    }
                    else
                    {
                        toPoint = new Vector3(centerPos.x + radius * Mathf.Sin(currAngle),
                                              centerPos.y + radius * Mathf.Cos(currAngle));
                        if (areaStyle != null && areaStyle.show)
                        {
                            UGL.DrawTriangle(vh, startPoint, toPoint, centerPos, areaColor, areaColor, areaToColor);
                        }
                        if (lineStyle.show)
                        {
                            ChartDrawer.DrawLineStyle(vh, lineStyle.type, lineWidth, startPoint, toPoint, lineColor);
                        }
                        startPoint = toPoint;
                    }
                    serieData.context.dataPoints.Add(startPoint);
                }
                if (areaStyle != null && areaStyle.show)
                {
                    UGL.DrawTriangle(vh, startPoint, firstPoint, centerPos, areaColor, areaColor, areaToColor);
                }
                if (lineStyle.show)
                {
                    ChartDrawer.DrawLineStyle(vh, lineStyle.type, lineWidth, startPoint, firstPoint, lineColor);
                }
                if (symbol.show && symbol.type != SymbolType.None)
                {
                    for (int m = 0; m < serieData.context.dataPoints.Count; m++)
                    {
                        var point      = serieData.context.dataPoints[m];
                        var symbolSize = isHighlight ?
                                         symbol.GetSelectedSize(null, chart.theme.serie.lineSymbolSelectedSize) :
                                         symbol.GetSize(null, chart.theme.serie.lineSymbolSize);
                        if (!serieData.interact.TryGetValue(ref symbolSize, ref interacting))
                        {
                            symbolSize = isHighlight ?
                                         symbol.GetSelectedSize(serieData.data, symbolSize) :
                                         symbol.GetSize(serieData.data, symbolSize);
                            serieData.interact.SetValue(ref interacting, symbolSize);
                            symbolSize = serie.animation.GetSysmbolSize(symbolSize);
                        }
                        var symbolColor      = SerieHelper.GetItemColor(serie, serieData, chart.theme, j, isHighlight);
                        var symbolToColor    = SerieHelper.GetItemToColor(serie, serieData, chart.theme, j, isHighlight);
                        var symbolEmptyColor = SerieHelper.GetItemBackgroundColor(serie, serieData, chart.theme, j, isHighlight, false);
                        var symbolBorder     = SerieHelper.GetSymbolBorder(serie, serieData, chart.theme, isHighlight);
                        var borderColor      = SerieHelper.GetSymbolBorderColor(serie, serieData, chart.theme, isHighlight);
                        var cornerRadius     = SerieHelper.GetSymbolCornerRadius(serie, serieData, isHighlight);
                        chart.DrawSymbol(vh, symbol.type, symbolSize, symbolBorder, point, symbolColor,
                                         symbolToColor, symbolEmptyColor, borderColor, symbol.gap, cornerRadius);
                    }
                }
            }
            if (!serie.animation.IsFinish())
            {
                serie.animation.CheckProgress(1);
                chart.RefreshPainter(serie);
            }
            if (dataChanging || interacting)
            {
                chart.RefreshPainter(serie);
            }
        }
        private void UpdateSerieContext()
        {
            var needCheck = m_LegendEnter ||
                            (chart.isPointerInChart && (m_RadarCoord != null && m_RadarCoord.IsPointerEnter()));
            var needInteract = false;
            var needHideAll  = false;

            if (!needCheck)
            {
                if (m_LastCheckContextFlag == needCheck)
                {
                    return;
                }
                needHideAll = true;
            }
            m_LastCheckContextFlag             = needCheck;
            serie.context.pointerEnter         = false;
            serie.context.pointerItemDataIndex = -1;
            var areaStyle = serie.areaStyle;

            switch (serie.radarType)
            {
            case RadarType.Multiple:
                for (int i = 0; i < serie.data.Count; i++)
                {
                    var serieData = serie.data[i];
                    serieData.index = i;
                    var symbol     = SerieHelper.GetSerieSymbol(serie, serieData);
                    var symbolSize = symbol.GetSize(serieData.data, chart.theme.serie.lineSymbolSize);
                    if (needHideAll || m_LegendEnter)
                    {
                        serieData.context.highlight = needHideAll ? false : true;
                        serieData.interact.SetValue(ref needInteract, symbolSize, serieData.context.highlight);
                    }
                    else
                    {
                        serieData.context.highlight = false;
                        foreach (var pos in serieData.context.dataPoints)
                        {
                            if (Vector3.Distance(chart.pointerPos, pos) < symbolSize * 2)
                            {
                                serie.context.pointerEnter         = true;
                                serie.context.pointerItemDataIndex = i;
                                serieData.context.highlight        = true;
                                break;
                            }
                        }
                        if (!serieData.context.highlight && areaStyle != null)
                        {
                            var center     = m_RadarCoord.context.center;
                            var dataPoints = serieData.context.dataPoints;
                            for (int n = 0; n < dataPoints.Count; n++)
                            {
                                var p1 = dataPoints[n];
                                var p2 = n >= dataPoints.Count - 1 ? dataPoints[0] : dataPoints[n + 1];
                                if (UGLHelper.IsPointInTriangle(p1, center, p2, chart.pointerPos))
                                {
                                    serie.context.pointerEnter         = true;
                                    serie.context.pointerItemDataIndex = i;
                                    serieData.context.highlight        = true;
                                    break;
                                }
                            }
                        }
                        serieData.interact.SetValue(ref needInteract, symbolSize, serieData.context.highlight);
                    }
                }
                break;

            case RadarType.Single:
                for (int i = 0; i < serie.data.Count; i++)
                {
                    var serieData = serie.data[i];
                    serieData.index = i;
                    if (Vector3.Distance(chart.pointerPos, serieData.context.position) < serie.symbol.size * 2)
                    {
                        serie.context.pointerEnter         = true;
                        serie.context.pointerItemDataIndex = i;
                        return;
                    }
                }
                if (!serie.context.pointerEnter && areaStyle != null)
                {
                    var center     = m_RadarCoord.context.center;
                    var dataPoints = serie.data;
                    for (int n = 0; n < dataPoints.Count; n++)
                    {
                        var p1 = dataPoints[n];
                        var p2 = n >= dataPoints.Count - 1 ? dataPoints[0] : dataPoints[n + 1];
                        if (UGLHelper.IsPointInTriangle(p1.context.position, center, p2.context.position, chart.pointerPos))
                        {
                            serie.context.pointerEnter         = true;
                            serie.context.pointerItemDataIndex = n;
                            p1.context.highlight = true;
                            break;
                        }
                    }
                }
                break;
            }
            if (needInteract)
            {
                chart.RefreshPainter(serie);
            }
        }