Ejemplo n.º 1
0
        public static float GetAxisPosition(GridCoord grid, Axis axis, double value, int dataCount = 0, DataZoom dataZoom = null)
        {
            var gridHeight = axis is YAxis ? grid.context.height : grid.context.width;
            var gridXY     = axis is YAxis ? grid.context.y : grid.context.x;

            if (axis.IsCategory())
            {
                if (dataCount == 0)
                {
                    dataCount = axis.data.Count;
                }
                var   categoryIndex = (int)value;
                var   scaleWid      = AxisHelper.GetDataWidth(axis, gridHeight, dataCount, dataZoom);
                float startY        = gridXY + (axis.boundaryGap ? scaleWid / 2 : 0);
                return(startY + scaleWid * categoryIndex);
            }
            else
            {
                var yDataHig = (axis.context.minMaxRange == 0) ? 0f :
                               (float)((value - axis.context.minValue) / axis.context.minMaxRange * gridHeight);
                return(gridXY + yDataHig);
            }
        }
        private void DrawCandlestickSerie(VertexHelper vh, SimplifiedCandlestick serie)
        {
            if (!serie.show)
            {
                return;
            }
            if (serie.animation.HasFadeOut())
            {
                return;
            }
            XAxis     xAxis;
            YAxis     yAxis;
            GridCoord grid;

            if (!chart.TryGetChartComponent <XAxis>(out xAxis, serie.xAxisIndex))
            {
                return;
            }
            if (!chart.TryGetChartComponent <YAxis>(out yAxis, serie.yAxisIndex))
            {
                return;
            }
            if (!chart.TryGetChartComponent <GridCoord>(out grid, xAxis.gridIndex))
            {
                return;
            }
            var   theme         = chart.theme;
            var   dataZoom      = chart.GetDataZoomOfAxis(xAxis);
            var   showData      = serie.GetDataList(dataZoom);
            float categoryWidth = AxisHelper.GetDataWidth(xAxis, grid.context.width, showData.Count, dataZoom);
            float barWidth      = serie.GetBarWidth(categoryWidth);
            float gap           = (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();
            double yMinValue          = yAxis.context.minValue;
            double yMaxValue          = yAxis.context.maxValue;
            var    isYAxis            = false;
            var    itemStyle          = serie.itemStyle;

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

            for (int i = serie.minShow; i < maxCount; i++)
            {
                var serieData = showData[i];
                if (serie.IsIgnoreValue(serieData))
                {
                    serie.context.dataPoints.Add(Vector3.zero);
                    continue;
                }
                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 = yAxis.inverse ? close <open : close> open;
                var borderWidth = open == 0 ? 0f :
                                  (itemStyle.runtimeBorderWidth == 0 ? theme.serie.candlestickBorderWidth :
                                   itemStyle.runtimeBorderWidth);
                if (serieData.IsDataChanged())
                {
                    dataChanging = true;
                }
                float pX    = grid.context.x + i * categoryWidth;
                float zeroY = grid.context.y + yAxis.context.offset;
                if (!xAxis.boundaryGap)
                {
                    pX -= categoryWidth / 2;
                }
                float  pY         = zeroY;
                var    barHig     = 0f;
                double valueTotal = yMaxValue - yMinValue;
                var    minCut     = (yMinValue > 0 ? yMinValue : 0);
                if (valueTotal != 0)
                {
                    barHig = (float)((close - open) / valueTotal * grid.context.height);
                    pY    += (float)((open - minCut) / valueTotal * grid.context.height);
                }
                serieData.context.stackHeight = barHig;
                float   currHig = AnimationStyleHelper.CheckDataAnimation(chart, serie, i, barHig);
                Vector3 plb, plt, prt, prb, top;

                plb = new Vector3(pX + gap + borderWidth, pY + borderWidth);
                plt = new Vector3(pX + gap + borderWidth, pY + currHig - borderWidth);
                prt = new Vector3(pX + gap + barWidth - borderWidth, pY + currHig - borderWidth);
                prb = new Vector3(pX + gap + barWidth - borderWidth, pY + borderWidth);
                top = new Vector3(pX + gap + barWidth / 2, pY + currHig - borderWidth);
                // if (serie.clip)
                // {
                //     plb = chart.ClampInGrid(grid, plb);
                //     plt = chart.ClampInGrid(grid, plt);
                //     prt = chart.ClampInGrid(grid, prt);
                //     prb = chart.ClampInGrid(grid, prb);
                //     top = chart.ClampInGrid(grid, top);
                // }
                serie.context.dataPoints.Add(top);
                var areaColor = isRise ?
                                itemStyle.GetColor(theme.serie.candlestickColor) :
                                itemStyle.GetColor0(theme.serie.candlestickColor0);
                var borderColor = isRise ?
                                  itemStyle.GetBorderColor(theme.serie.candlestickBorderColor) :
                                  itemStyle.GetBorderColor0(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 + (float)((lowest - minCut) / valueTotal * grid.context.height));
                var heighPos       = new Vector3(center.x, zeroY + (float)((heighest - minCut) / valueTotal * grid.context.height));
                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 (itemStyle.IsNeedCorner())
                        {
                            UGL.DrawRoundRectangle(vh, center, itemWidth, itemHeight, areaColor, areaColor, 0,
                                                   itemStyle.cornerRadius, isYAxis, 0.5f);
                        }
                        else
                        {
                            chart.DrawClipPolygon(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);
                    }
                    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);
                    }
                }
                else
                {
                    UGL.DrawLine(vh, openCenterPos, closeCenterPos, Mathf.Max(borderWidth, barWidth / 2), borderColor);
                }
            }
            if (!serie.animation.IsFinish())
            {
                serie.animation.CheckProgress();
            }
            if (dataChanging)
            {
                chart.RefreshPainter(serie);
            }
        }
Ejemplo n.º 3
0
        private void DrawVerticalDataZoomSlider(VertexHelper vh, DataZoom dataZoom)
        {
            if (!dataZoom.enable || !dataZoom.supportSlider)
            {
                return;
            }

            var p1              = new Vector3(dataZoom.context.x, dataZoom.context.y);
            var p2              = new Vector3(dataZoom.context.x, dataZoom.context.y + dataZoom.context.height);
            var p3              = new Vector3(dataZoom.context.x + dataZoom.context.width, dataZoom.context.y + dataZoom.context.height);
            var p4              = new Vector3(dataZoom.context.x + dataZoom.context.width, dataZoom.context.y);
            var lineColor       = dataZoom.lineStyle.GetColor(chart.theme.dataZoom.dataLineColor);
            var lineWidth       = dataZoom.lineStyle.GetWidth(chart.theme.dataZoom.dataLineWidth);
            var borderWidth     = dataZoom.borderWidth == 0 ? chart.theme.dataZoom.borderWidth : dataZoom.borderWidth;
            var borderColor     = dataZoom.GetBorderColor(chart.theme.dataZoom.borderColor);
            var backgroundColor = dataZoom.GetBackgroundColor(chart.theme.dataZoom.backgroundColor);
            var areaColor       = dataZoom.areaStyle.GetColor(chart.theme.dataZoom.dataAreaColor);

            UGL.DrawQuadrilateral(vh, p1, p2, p3, p4, backgroundColor);
            var centerPos = new Vector3(dataZoom.context.x + dataZoom.context.width / 2,
                                        dataZoom.context.y + dataZoom.context.height / 2);

            UGL.DrawBorder(vh, centerPos, dataZoom.context.width, dataZoom.context.height, borderWidth, borderColor);

            if (dataZoom.showDataShadow && chart.series.Count > 0)
            {
                Serie   serie    = chart.series[0];
                Axis    axis     = chart.GetChartComponent <YAxis>(0);
                var     showData = serie.GetDataList(null);
                float   scaleWid = dataZoom.context.height / (showData.Count - 1);
                Vector3 lp       = Vector3.zero;
                Vector3 np       = Vector3.zero;
                double  minValue = 0;
                double  maxValue = 0;
                SeriesHelper.GetYMinMaxValue(chart.series, null, 0, chart.IsAllAxisValue(), axis.inverse, out minValue, out maxValue);
                AxisHelper.AdjustMinMaxValue(axis, ref minValue, ref maxValue, true);

                int rate       = 1;
                var sampleDist = serie.sampleDist < 2 ? 2 : serie.sampleDist;
                var maxCount   = showData.Count;
                if (sampleDist > 0)
                {
                    rate = (int)((maxCount - serie.minShow) / (dataZoom.context.height / sampleDist));
                }
                if (rate < 1)
                {
                    rate = 1;
                }

                var totalAverage = serie.sampleAverage > 0 ? serie.sampleAverage :
                                   DataHelper.DataAverage(ref showData, serie.sampleType, serie.minShow, maxCount, rate);
                var dataChanging = false;

                for (int i = 0; i < maxCount; i += rate)
                {
                    double value = DataHelper.SampleValue(ref showData, serie.sampleType, rate, serie.minShow, maxCount, totalAverage, i,
                                                          serie.animation.GetUpdateAnimationDuration(), ref dataChanging, axis);
                    float pY      = dataZoom.context.y + i * scaleWid;
                    float dataHig = (maxValue - minValue) == 0 ? 0 :
                                    (float)((value - minValue) / (maxValue - minValue) * dataZoom.context.width);
                    np = new Vector3(chart.chartX + chart.chartWidth - dataZoom.right - dataHig, pY);
                    if (i > 0)
                    {
                        UGL.DrawLine(vh, lp, np, lineWidth, lineColor);
                        Vector3 alp = new Vector3(lp.x, lp.y - lineWidth);
                        Vector3 anp = new Vector3(np.x, np.y - lineWidth);

                        Vector3 tnp = new Vector3(np.x, chart.chartY + dataZoom.bottom + lineWidth);
                        Vector3 tlp = new Vector3(lp.x, chart.chartY + dataZoom.bottom + lineWidth);
                        UGL.DrawQuadrilateral(vh, alp, anp, tnp, tlp, areaColor);
                    }
                    lp = np;
                }
                if (dataChanging)
                {
                    chart.RefreshTopPainter();
                }
            }
            switch (dataZoom.rangeMode)
            {
            case DataZoom.RangeMode.Percent:
                var start       = dataZoom.context.y + dataZoom.context.height * dataZoom.start / 100;
                var end         = dataZoom.context.y + dataZoom.context.height * dataZoom.end / 100;
                var fillerColor = dataZoom.GetFillerColor(chart.theme.dataZoom.fillerColor);

                p1 = new Vector2(dataZoom.context.x, start);
                p2 = new Vector2(dataZoom.context.x + dataZoom.context.width, start);
                p3 = new Vector2(dataZoom.context.x + dataZoom.context.width, end);
                p4 = new Vector2(dataZoom.context.x, end);
                UGL.DrawQuadrilateral(vh, p1, p2, p3, p4, fillerColor);
                UGL.DrawLine(vh, p1, p2, lineWidth, fillerColor);
                UGL.DrawLine(vh, p3, p4, lineWidth, fillerColor);
                break;
            }
        }
Ejemplo n.º 4
0
        private void DrawLineSerie(VertexHelper vh, Line serie)
        {
            if (!serie.show)
            {
                return;
            }
            if (serie.animation.HasFadeOut())
            {
                return;
            }

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

            if (axis == null)
            {
                return;
            }
            if (relativedAxis == null)
            {
                return;
            }

            m_SerieGrid = chart.GetChartComponent <GridCoord>(axis.gridIndex);
            if (m_SerieGrid == null)
            {
                return;
            }
            if (m_EndLabel != null && !m_SerieGrid.context.endLabelList.Contains(m_EndLabel))
            {
                m_SerieGrid.context.endLabelList.Add(m_EndLabel);
            }

            var visualMap = chart.GetVisualMapOfSerie(serie);
            var dataZoom  = chart.GetDataZoomOfAxis(axis);
            var showData  = serie.GetDataList(dataZoom);

            if (showData.Count <= 0)
            {
                return;
            }

            var axisLength = isY ? m_SerieGrid.context.height : m_SerieGrid.context.width;
            var scaleWid   = AxisHelper.GetDataWidth(axis, axisLength, showData.Count, dataZoom);

            int maxCount = serie.maxShow > 0 ?
                           (serie.maxShow > showData.Count ? showData.Count : serie.maxShow) :
                           showData.Count;
            int rate         = LineHelper.GetDataAverageRate(serie, m_SerieGrid, maxCount, false);
            var totalAverage = serie.sampleAverage > 0 ?
                               serie.sampleAverage :
                               DataHelper.DataAverage(ref showData, serie.sampleType, serie.minShow, maxCount, rate);
            var dataChanging       = false;
            var dataChangeDuration = serie.animation.GetUpdateAnimationDuration();

            var interacting = false;
            var lineWidth   = LineHelper.GetLineWidth(ref interacting, serie, chart.theme.serie.lineWidth);

            axis.context.scaleWidth    = scaleWid;
            serie.containerIndex       = m_SerieGrid.index;
            serie.containterInstanceId = m_SerieGrid.instanceId;

            Serie lastSerie = null;
            var   isStack   = SeriesHelper.IsStack <Line>(chart.series, serie.stack);

            if (isStack)
            {
                lastSerie = SeriesHelper.GetLastStackSerie(chart.series, serie);
                SeriesHelper.UpdateStackDataList(chart.series, serie, dataZoom, m_StackSerieData);
            }
            var lp = Vector3.zero;

            for (int i = serie.minShow; i < maxCount; i += rate)
            {
                var serieData = showData[i];
                var isIgnore  = serie.IsIgnoreValue(serieData);
                if (isIgnore)
                {
                    serieData.context.stackHeight = 0;
                    serieData.context.position    = Vector3.zero;
                    if (serie.ignoreLineBreak && serie.context.dataIgnores.Count > 0)
                    {
                        serie.context.dataIgnores[serie.context.dataIgnores.Count - 1] = true;
                    }
                }
                else
                {
                    var np             = Vector3.zero;
                    var xValue         = axis.IsCategory() ? i : serieData.GetData(0, axis.inverse);
                    var relativedValue = DataHelper.SampleValue(ref showData, serie.sampleType, rate, serie.minShow,
                                                                maxCount, totalAverage, i, dataChangeDuration, ref dataChanging, relativedAxis);

                    serieData.context.stackHeight = GetDataPoint(isY, axis, relativedAxis, m_SerieGrid, xValue, relativedValue,
                                                                 i, scaleWid, isStack, ref np);
                    serieData.context.isClip = false;
                    if (serie.clip && !m_SerieGrid.Contains(np))
                    {
                        if (m_SerieGrid.BoundaryPoint(lp, np, ref np))
                        {
                            serieData.context.isClip = true;
                        }
                    }
                    serie.context.dataIgnores.Add(false);
                    serieData.context.position = np;
                    serie.context.dataPoints.Add(np);
                    lp = np;
                }
            }

            if (dataChanging || interacting)
            {
                chart.RefreshPainter(serie);
            }

            if (serie.context.dataPoints.Count <= 0)
            {
                return;
            }

            serie.animation.InitProgress(serie.context.dataPoints, isY);

            VisualMapHelper.AutoSetLineMinMax(visualMap, serie, isY, axis, relativedAxis);
            LineHelper.UpdateSerieDrawPoints(serie, chart.settings, chart.theme, visualMap, lineWidth, isY);
            LineHelper.DrawSerieLineArea(vh, serie, lastSerie, chart.theme, visualMap, isY, axis, relativedAxis, m_SerieGrid);
            LineHelper.DrawSerieLine(vh, chart.theme, serie, visualMap, m_SerieGrid, axis, relativedAxis, lineWidth);

            serie.context.vertCount = vh.currentVertCount;

            if (!serie.animation.IsFinish())
            {
                serie.animation.CheckProgress();
                serie.animation.CheckSymbol(serie.symbol.GetSize(null, chart.theme.serie.lineSymbolSize));
                chart.RefreshPainter(serie);
            }
        }
Ejemplo n.º 5
0
        private Vector3 GetPosition(MarkAreaData data, Serie serie, DataZoom dataZoom, XAxis xAxis, YAxis yAxis,
                                    GridCoord grid, List <SerieData> showData, bool start)
        {
            var pos = Vector3.zero;

            switch (data.type)
            {
            case MarkAreaType.Min:
                data.runtimeValue = SerieHelper.GetMinData(serie, data.dimension, dataZoom);
                return(GetPosition(xAxis, yAxis, grid, data.runtimeValue, start));

            case MarkAreaType.Max:
                data.runtimeValue = SerieHelper.GetMaxData(serie, data.dimension, dataZoom);
                return(GetPosition(xAxis, yAxis, grid, data.runtimeValue, start));

            case MarkAreaType.Average:
                data.runtimeValue = SerieHelper.GetAverageData(serie, data.dimension, dataZoom);
                return(GetPosition(xAxis, yAxis, grid, data.runtimeValue, start));

            case MarkAreaType.Median:
                data.runtimeValue = SerieHelper.GetMedianData(serie, data.dimension, dataZoom);
                return(GetPosition(xAxis, yAxis, grid, data.runtimeValue, start));

            case MarkAreaType.None:
                if (data.xPosition != 0 || data.yPosition != 0)
                {
                    var pX = grid.context.x + data.xPosition;
                    var pY = grid.context.y + data.yPosition;
                    return(new Vector3(pX, pY));
                }
                else if (data.yValue != 0)
                {
                    data.runtimeValue = data.yValue;
                    if (yAxis.IsCategory())
                    {
                        var pY = AxisHelper.GetAxisPosition(grid, yAxis, data.yValue, showData.Count, dataZoom);
                        return(start ?
                               new Vector3(grid.context.x, pY) :
                               new Vector3(grid.context.x + grid.context.width, pY));
                    }
                    else
                    {
                        return(GetPosition(xAxis, yAxis, grid, data.runtimeValue, start));
                    }
                }
                else
                {
                    data.runtimeValue = data.xValue;
                    if (xAxis.IsCategory())
                    {
                        var pX = AxisHelper.GetAxisPosition(grid, xAxis, data.xValue, showData.Count, dataZoom);
                        return(start ? new Vector3(pX, grid.context.y + grid.context.height) :
                               new Vector3(pX, grid.context.y));
                    }
                    else
                    {
                        return(GetPosition(xAxis, yAxis, grid, data.xValue, start));
                    }
                }

            default:
                break;
            }
            return(pos);
        }
Ejemplo n.º 6
0
        private void DrawBarSerie(VertexHelper vh, SimplifiedBar serie, int colorIndex)
        {
            if (!serie.show || serie.animation.HasFadeOut())
            {
                return;
            }

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

            m_SerieGrid = chart.GetChartComponent <GridCoord>(axis.gridIndex);

            if (axis == null)
            {
                return;
            }
            if (relativedAxis == null)
            {
                return;
            }
            if (m_SerieGrid == null)
            {
                return;
            }

            var dataZoom = chart.GetDataZoomOfAxis(axis);
            var showData = serie.GetDataList(dataZoom);

            if (showData.Count <= 0)
            {
                return;
            }

            var axisLength = isY ? m_SerieGrid.context.height : m_SerieGrid.context.width;
            var axisXY     = isY ? m_SerieGrid.context.y : m_SerieGrid.context.x;

            var   barCount      = chart.GetSerieBarRealCount <SimplifiedBar>();
            float categoryWidth = AxisHelper.GetDataWidth(axis, axisLength, showData.Count, dataZoom);
            float barGap        = chart.GetSerieBarGap <SimplifiedBar>();
            float totalBarWidth = chart.GetSerieTotalWidth <SimplifiedBar>(categoryWidth, barGap, barCount);
            float barWidth      = serie.GetBarWidth(categoryWidth, barCount);
            float offset        = (categoryWidth - totalBarWidth) * 0.5f;
            float barGapWidth   = barWidth + barWidth * barGap;
            float gap           = serie.barGap == -1 ? offset : offset + serie.index * barGapWidth;
            int   maxCount      = serie.maxShow > 0 ?
                                  (serie.maxShow > showData.Count ? showData.Count : serie.maxShow) :
                                  showData.Count;

            bool   dataChanging       = false;
            float  dataChangeDuration = serie.animation.GetUpdateAnimationDuration();
            double yMinValue          = relativedAxis.context.minValue;
            double yMaxValue          = relativedAxis.context.maxValue;

            var areaColor   = ColorUtil.clearColor32;
            var areaToColor = ColorUtil.clearColor32;
            var interacting = false;

            serie.containerIndex       = m_SerieGrid.index;
            serie.containterInstanceId = m_SerieGrid.instanceId;
            serie.animation.InitProgress(axisXY, axisXY + axisLength);
            for (int i = serie.minShow; i < maxCount; i++)
            {
                var serieData = showData[i];
                if (!serieData.show || serie.IsIgnoreValue(serieData))
                {
                    serie.context.dataPoints.Add(Vector3.zero);
                    continue;
                }

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

                var highlight      = serieData.context.highlight || serie.highlight;
                var itemStyle      = SerieHelper.GetItemStyle(serie, serieData, highlight);
                var value          = axis.IsCategory() ? i : serieData.GetData(0, axis.inverse);
                var relativedValue = serieData.GetCurrData(1, dataChangeDuration, relativedAxis.inverse, yMinValue, yMaxValue);
                var borderWidth    = relativedValue == 0 ? 0 : itemStyle.runtimeBorderWidth;

                if (!serieData.interact.TryGetColor(ref areaColor, ref areaToColor, ref interacting))
                {
                    areaColor   = SerieHelper.GetItemColor(serie, serieData, chart.theme, colorIndex, highlight);
                    areaToColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, colorIndex, highlight);
                    serieData.interact.SetColor(ref interacting, areaColor, areaToColor);
                }

                var pX = 0f;
                var pY = 0f;
                UpdateXYPosition(m_SerieGrid, isY, axis, relativedAxis, i, categoryWidth, barWidth, value, ref pX, ref pY);

                var barHig  = AxisHelper.GetAxisValueLength(m_SerieGrid, relativedAxis, categoryWidth, relativedValue);
                var currHig = AnimationStyleHelper.CheckDataAnimation(chart, serie, i, barHig);

                Vector3 plb, plt, prt, prb, top;
                UpdateRectPosition(m_SerieGrid, isY, relativedValue, pX, pY, gap, borderWidth, barWidth, currHig,
                                   out plb, out plt, out prt, out prb, out top);
                serieData.context.stackHeight = barHig;
                serieData.context.position    = top;
                serieData.context.rect        = Rect.MinMaxRect(plb.x, plb.y, prb.x, prt.y);
                serie.context.dataPoints.Add(top);
                DrawNormalBar(vh, serie, serieData, itemStyle, colorIndex, highlight, gap, barWidth,
                              pX, pY, plb, plt, prt, prb, false, m_SerieGrid, areaColor, areaToColor);

                if (serie.animation.CheckDetailBreak(top, isY))
                {
                    break;
                }
            }
            if (!serie.animation.IsFinish())
            {
                serie.animation.CheckProgress();
                chart.RefreshPainter(serie);
            }
            if (dataChanging || interacting)
            {
                chart.RefreshPainter(serie);
            }
        }
        private void DrawLineSerie(VertexHelper vh, SimplifiedLine serie)
        {
            if (!serie.show)
            {
                return;
            }
            if (serie.animation.HasFadeOut())
            {
                return;
            }

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

            m_SerieGrid = chart.GetChartComponent <GridCoord>(axis.gridIndex);

            if (axis == null)
            {
                return;
            }
            if (relativedAxis == null)
            {
                return;
            }
            if (m_SerieGrid == null)
            {
                return;
            }

            var dataZoom = chart.GetDataZoomOfAxis(axis);
            var showData = serie.GetDataList(dataZoom);

            if (showData.Count <= 0)
            {
                return;
            }

            var axisLength = isY ? m_SerieGrid.context.height : m_SerieGrid.context.width;
            var scaleWid   = AxisHelper.GetDataWidth(axis, axisLength, showData.Count, dataZoom);

            int maxCount = serie.maxShow > 0 ?
                           (serie.maxShow > showData.Count ? showData.Count : serie.maxShow) :
                           showData.Count;
            int rate         = LineHelper.GetDataAverageRate(serie, m_SerieGrid, maxCount, false);
            var totalAverage = serie.sampleAverage > 0 ?
                               serie.sampleAverage :
                               DataHelper.DataAverage(ref showData, serie.sampleType, serie.minShow, maxCount, rate);
            var dataChanging       = false;
            var dataChangeDuration = serie.animation.GetUpdateAnimationDuration();

            var interacting = false;
            var lineWidth   = LineHelper.GetLineWidth(ref interacting, serie, chart.theme.serie.lineWidth);

            axis.context.scaleWidth    = scaleWid;
            serie.containerIndex       = m_SerieGrid.index;
            serie.containterInstanceId = m_SerieGrid.instanceId;

            for (int i = serie.minShow; i < maxCount; i += rate)
            {
                var serieData = showData[i];
                var isIgnore  = serie.IsIgnoreValue(serieData);
                if (isIgnore)
                {
                    serieData.context.stackHeight = 0;
                    serieData.context.position    = Vector3.zero;
                    if (serie.ignoreLineBreak && serie.context.dataIgnores.Count > 0)
                    {
                        serie.context.dataIgnores[serie.context.dataIgnores.Count - 1] = true;
                    }
                }
                else
                {
                    var np             = Vector3.zero;
                    var xValue         = axis.IsCategory() ? i : serieData.GetData(0, axis.inverse);
                    var relativedValue = DataHelper.SampleValue(ref showData, serie.sampleType, rate, serie.minShow,
                                                                maxCount, totalAverage, i, dataChangeDuration, ref dataChanging, relativedAxis);

                    serieData.context.stackHeight = GetDataPoint(isY, axis, relativedAxis, m_SerieGrid, xValue, relativedValue,
                                                                 i, scaleWid, false, ref np);

                    serieData.context.position = np;

                    serie.context.dataPoints.Add(np);
                    serie.context.dataIgnores.Add(false);
                }
            }

            if (dataChanging || interacting)
            {
                chart.RefreshPainter(serie);
            }

            if (serie.context.dataPoints.Count <= 0)
            {
                return;
            }

            serie.animation.InitProgress(serie.context.dataPoints, isY);

            LineHelper.UpdateSerieDrawPoints(serie, chart.settings, chart.theme, null, lineWidth, isY);
            LineHelper.DrawSerieLineArea(vh, serie, null, chart.theme, null, isY, axis, relativedAxis, m_SerieGrid);
            LineHelper.DrawSerieLine(vh, chart.theme, serie, null, m_SerieGrid, axis, relativedAxis, lineWidth);

            serie.context.vertCount = vh.currentVertCount;

            if (!serie.animation.IsFinish())
            {
                serie.animation.CheckProgress();
                chart.RefreshPainter(serie);
            }
        }
        private void DrawMarkLine(VertexHelper vh, MarkLine markLine)
        {
            var serie = chart.GetSerie(markLine.serieIndex);

            if (!serie.show || !markLine.show)
            {
                return;
            }
            if (markLine.data.Count == 0)
            {
                return;
            }
            var yAxis      = chart.GetChartComponent <YAxis>(serie.yAxisIndex);
            var xAxis      = chart.GetChartComponent <XAxis>(serie.xAxisIndex);
            var grid       = chart.GetChartComponent <GridCoord>(xAxis.gridIndex);
            var dataZoom   = chart.GetDataZoomOfAxis(xAxis);
            var animation  = markLine.animation;
            var showData   = serie.GetDataList(dataZoom);
            var sp         = Vector3.zero;
            var ep         = Vector3.zero;
            var colorIndex = chart.GetLegendRealShowNameIndex(serie.serieName);
            var serieColor = SerieHelper.GetLineColor(serie, null, chart.theme, colorIndex, false);

            animation.InitProgress(0, 1f);
            ResetTempMarkLineGroupData(markLine);
            if (m_TempGroupData.Count > 0)
            {
                foreach (var kv in m_TempGroupData)
                {
                    if (kv.Value.Count >= 2)
                    {
                        sp = GetSinglePos(xAxis, yAxis, grid, serie, dataZoom, kv.Value[0], showData.Count);
                        ep = GetSinglePos(xAxis, yAxis, grid, serie, dataZoom, kv.Value[1], showData.Count);
                        kv.Value[0].runtimeStartPosition = sp;
                        kv.Value[1].runtimeEndPosition   = ep;
                        DrawMakLineData(vh, kv.Value[0], animation, serie, grid, serieColor, sp, ep);
                    }
                }
            }
            foreach (var data in markLine.data)
            {
                if (data.group != 0)
                {
                    continue;
                }
                switch (data.type)
                {
                case MarkLineType.Min:
                    data.runtimeValue = SerieHelper.GetMinData(serie, data.dimension, dataZoom);
                    GetStartEndPos(xAxis, yAxis, grid, data.runtimeValue, ref sp, ref ep);
                    break;

                case MarkLineType.Max:
                    data.runtimeValue = SerieHelper.GetMaxData(serie, data.dimension, dataZoom);
                    GetStartEndPos(xAxis, yAxis, grid, data.runtimeValue, ref sp, ref ep);
                    break;

                case MarkLineType.Average:
                    data.runtimeValue = SerieHelper.GetAverageData(serie, data.dimension, dataZoom);
                    GetStartEndPos(xAxis, yAxis, grid, data.runtimeValue, ref sp, ref ep);
                    break;

                case MarkLineType.Median:
                    data.runtimeValue = SerieHelper.GetMedianData(serie, data.dimension, dataZoom);
                    GetStartEndPos(xAxis, yAxis, grid, data.runtimeValue, ref sp, ref ep);
                    break;

                case MarkLineType.None:
                    if (data.xPosition != 0)
                    {
                        data.runtimeValue = data.xPosition;
                        var pX = grid.context.x + data.xPosition;
                        sp = new Vector3(pX, grid.context.y);
                        ep = new Vector3(pX, grid.context.y + grid.context.height);
                    }
                    else if (data.yPosition != 0)
                    {
                        data.runtimeValue = data.yPosition;
                        var pY = grid.context.y + data.yPosition;
                        sp = new Vector3(grid.context.x, pY);
                        ep = new Vector3(grid.context.x + grid.context.width, pY);
                    }
                    else if (data.yValue != 0)
                    {
                        data.runtimeValue = data.yValue;
                        if (yAxis.IsCategory())
                        {
                            var pY = AxisHelper.GetAxisPosition(grid, yAxis, data.yValue, showData.Count, dataZoom);
                            sp = new Vector3(grid.context.x, pY);
                            ep = new Vector3(grid.context.x + grid.context.width, pY);
                        }
                        else
                        {
                            GetStartEndPos(xAxis, yAxis, grid, data.yValue, ref sp, ref ep);
                        }
                    }
                    else
                    {
                        data.runtimeValue = data.xValue;
                        if (xAxis.IsCategory())
                        {
                            var pX = AxisHelper.GetAxisPosition(grid, xAxis, data.xValue, showData.Count, dataZoom);
                            sp = new Vector3(pX, grid.context.y);
                            ep = new Vector3(pX, grid.context.y + grid.context.height);
                        }
                        else
                        {
                            GetStartEndPos(xAxis, yAxis, grid, data.xValue, ref sp, ref ep);
                        }
                    }
                    break;

                default:
                    break;
                }
                data.runtimeStartPosition = sp;
                data.runtimeEndPosition   = ep;
                DrawMakLineData(vh, data, animation, serie, grid, serieColor, sp, ep);
            }
            if (!animation.IsFinish())
            {
                animation.CheckProgress(1f);
                chart.RefreshTopPainter();
            }
        }
 private float GetAxisPosition(GridCoord grid, Axis axis, DataZoom dataZoom, int dataCount, double value)
 {
     return(AxisHelper.GetAxisPosition(grid, axis, value, dataCount, dataZoom));
 }
        private void UpdateParallelAxisMinMaxValue()
        {
            var list = chart.GetChartComponents <ParallelAxis>();

            if (list.Count != component.context.parallelAxes.Count)
            {
                component.context.parallelAxes.Clear();
                foreach (var com in chart.GetChartComponents <ParallelAxis>())
                {
                    var axis = com as ParallelAxis;
                    if (axis.parallelIndex == component.index)
                    {
                        component.context.parallelAxes.Add(axis);
                    }
                }
            }
            m_SerieDimMin.Clear();
            m_SerieDimMax.Clear();
            foreach (var serie in chart.series)
            {
                if ((serie is Parallel) && serie.parallelIndex == component.index)
                {
                    foreach (var serieData in serie.data)
                    {
                        for (int i = 0; i < serieData.data.Count; i++)
                        {
                            var value = serieData.data[i];
                            if (!m_SerieDimMin.ContainsKey(i))
                            {
                                m_SerieDimMin[i] = value;
                            }
                            else if (m_SerieDimMin[i] > value)
                            {
                                m_SerieDimMin[i] = value;
                            }

                            if (!m_SerieDimMax.ContainsKey(i))
                            {
                                m_SerieDimMax[i] = value;
                            }
                            else if (m_SerieDimMax[i] < value)
                            {
                                m_SerieDimMax[i] = value;
                            }
                        }
                    }
                }
            }
            for (int i = 0; i < component.context.parallelAxes.Count; i++)
            {
                var axis = component.context.parallelAxes[i];
                if (axis.IsCategory())
                {
                    m_SerieDimMax[i] = axis.data.Count > 0 ? axis.data.Count - 1 : 0;
                    m_SerieDimMin[i] = 0;
                }
                else if (axis.minMaxType == Axis.AxisMinMaxType.Custom)
                {
                    m_SerieDimMin[i] = axis.min;
                    m_SerieDimMax[i] = axis.max;
                }
                else if (m_SerieDimMax.ContainsKey(i))
                {
                    var tempMinValue = m_SerieDimMin[i];
                    var tempMaxValue = m_SerieDimMax[i];
                    AxisHelper.AdjustMinMaxValue(axis, ref tempMinValue, ref tempMaxValue, true);
                    m_SerieDimMin[i] = tempMinValue;
                    m_SerieDimMax[i] = tempMaxValue;
                }
            }
            for (int i = 0; i < component.context.parallelAxes.Count; i++)
            {
                if (m_SerieDimMax.ContainsKey(i))
                {
                    var axis         = component.context.parallelAxes[i];
                    var tempMinValue = m_SerieDimMin[i];
                    var tempMaxValue = m_SerieDimMax[i];

                    if (tempMinValue != axis.context.minValue ||
                        tempMaxValue != axis.context.maxValue ||
                        m_LastInterval != axis.interval ||
                        m_LastSplitNumber != axis.splitNumber)
                    {
                        m_LastSplitNumber = axis.splitNumber;
                        m_LastInterval    = axis.interval;

                        axis.UpdateMinMaxValue(tempMinValue, tempMaxValue);
                        axis.context.offset           = 0;
                        axis.context.lastCheckInverse = axis.inverse;

                        (axis.handler as ParallelAxisHander).UpdateAxisTickValueList(axis);
                        (axis.handler as ParallelAxisHander).UpdateAxisLabelText(axis);
                        chart.RefreshChart();
                    }
                }
            }
        }
Ejemplo n.º 11
0
        internal static void DrawSerieLine(VertexHelper vh, ThemeStyle theme, Serie serie, VisualMap visualMap,
                                           GridCoord grid, Axis axis, Axis relativedAxis, float lineWidth)
        {
            if (!serie.lineStyle.show || serie.lineStyle.type == LineStyle.Type.None)
            {
                return;
            }

            var datas = serie.context.drawPoints;

            var dataCount = datas.Count;

            if (dataCount < 2)
            {
                return;
            }

            var ltp = Vector3.zero;
            var lbp = Vector3.zero;
            var ntp = Vector3.zero;
            var nbp = Vector3.zero;
            var itp = Vector3.zero;
            var ibp = Vector3.zero;
            var clp = Vector3.zero;
            var crp = Vector3.zero;

            var isBreak             = false;
            var isY                 = axis is YAxis;
            var isVisualMapGradient = VisualMapHelper.IsNeedLineGradient(visualMap);
            var isLineStyleGradient = serie.lineStyle.IsNeedGradient();

            //var highlight = serie.highlight || serie.context.pointerEnter;
            var lineColor = SerieHelper.GetLineColor(serie, null, theme, serie.context.colorIndex, false);

            var lastDataIsIgnore = datas[0].isIgnoreBreak;
            var smooth           = serie.lineType == LineType.Smooth;

            for (int i = 1; i < dataCount; i++)
            {
                var cdata    = datas[i];
                var isIgnore = cdata.isIgnoreBreak;

                var cp = cdata.position;
                var lp = datas[i - 1].position;

                var np = i == dataCount - 1 ? cp : datas[i + 1].position;
                if (serie.animation.CheckDetailBreak(cp, isY))
                {
                    isBreak = true;
                    var ip       = Vector3.zero;
                    var progress = serie.animation.GetCurrDetail();
                    if (AnimationStyleHelper.GetAnimationPosition(serie.animation, isY, lp, cp, progress, ref ip))
                    {
                        cp = np = ip;
                    }
                }
                serie.context.lineEndPostion = cp;
                serie.context.lineEndValue   = AxisHelper.GetAxisPositionValue(grid, relativedAxis, cp);
                lastDataIsIgnore             = isIgnore;
                var handled = false;
                if (!smooth)
                {
                    switch (serie.lineStyle.type)
                    {
                    case LineStyle.Type.Dashed:
                        UGL.DrawDashLine(vh, lp, cp, lineWidth, lineColor, lineColor, 0, 0);
                        handled = true;
                        break;

                    case LineStyle.Type.Dotted:
                        UGL.DrawDotLine(vh, lp, cp, lineWidth, lineColor, lineColor, 0, 0);
                        handled = true;
                        break;

                    case LineStyle.Type.DashDot:
                        UGL.DrawDashDotLine(vh, lp, cp, lineWidth, lineColor, 0, 0, 0);
                        handled = true;
                        break;

                    case LineStyle.Type.DashDotDot:
                        UGL.DrawDashDotDotLine(vh, lp, cp, lineWidth, lineColor, 0, 0, 0);
                        handled = true;
                        break;

                    case LineStyle.Type.None:
                        handled = true;
                        break;
                    }
                }
                if (handled)
                {
                    if (isBreak)
                    {
                        break;
                    }
                    else
                    {
                        continue;
                    }
                }
                bool bitp = true, bibp = true;
                UGLHelper.GetLinePoints(lp, cp, np, lineWidth,
                                        ref ltp, ref lbp,
                                        ref ntp, ref nbp,
                                        ref itp, ref ibp,
                                        ref clp, ref crp,
                                        ref bitp, ref bibp, i);
                if (i == 1)
                {
                    AddLineVertToVertexHelper(vh, ltp, lbp, lineColor, isVisualMapGradient, isLineStyleGradient,
                                              visualMap, serie.lineStyle, grid, axis, relativedAxis, false, lastDataIsIgnore, isIgnore);
                    if (dataCount == 2 || isBreak)
                    {
                        AddLineVertToVertexHelper(vh, clp, crp, lineColor, isVisualMapGradient, isLineStyleGradient,
                                                  visualMap, serie.lineStyle, grid, axis, relativedAxis, true, lastDataIsIgnore, isIgnore);
                        serie.context.lineEndPostion = cp;
                        serie.context.lineEndValue   = AxisHelper.GetAxisPositionValue(grid, relativedAxis, cp);
                        break;
                    }
                }

                if (bitp == bibp)
                {
                    if (bitp)
                    {
                        AddLineVertToVertexHelper(vh, itp, ibp, lineColor, isVisualMapGradient, isLineStyleGradient,
                                                  visualMap, serie.lineStyle, grid, axis, relativedAxis, true, lastDataIsIgnore, isIgnore);
                    }
                    else
                    {
                        AddLineVertToVertexHelper(vh, ltp, clp, lineColor, isVisualMapGradient, isLineStyleGradient,
                                                  visualMap, serie.lineStyle, grid, axis, relativedAxis, true, lastDataIsIgnore, isIgnore);
                        AddLineVertToVertexHelper(vh, ltp, crp, lineColor, isVisualMapGradient, isLineStyleGradient,
                                                  visualMap, serie.lineStyle, grid, axis, relativedAxis, true, lastDataIsIgnore, isIgnore);
                    }
                }
                else
                {
                    if (bitp)
                    {
                        AddLineVertToVertexHelper(vh, itp, clp, lineColor, isVisualMapGradient, isLineStyleGradient,
                                                  visualMap, serie.lineStyle, grid, axis, relativedAxis, true, lastDataIsIgnore, isIgnore);
                        AddLineVertToVertexHelper(vh, itp, crp, lineColor, isVisualMapGradient, isLineStyleGradient,
                                                  visualMap, serie.lineStyle, grid, axis, relativedAxis, true, lastDataIsIgnore, isIgnore);
                    }
                    else if (bibp)
                    {
                        AddLineVertToVertexHelper(vh, clp, ibp, lineColor, isVisualMapGradient, isLineStyleGradient,
                                                  visualMap, serie.lineStyle, grid, axis, relativedAxis, true, lastDataIsIgnore, isIgnore);
                        AddLineVertToVertexHelper(vh, crp, ibp, lineColor, isVisualMapGradient, isLineStyleGradient,
                                                  visualMap, serie.lineStyle, grid, axis, relativedAxis, true, lastDataIsIgnore, isIgnore);
                    }
                }

                if (isBreak)
                {
                    break;
                }
            }
        }
Ejemplo n.º 12
0
        private void DrawBarSerie(VertexHelper vh, Bar serie, int colorIndex)
        {
            if (!serie.show || serie.animation.HasFadeOut())
            {
                return;
            }

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

            m_SerieGrid = chart.GetChartComponent <GridCoord>(axis.gridIndex);

            if (axis == null)
            {
                return;
            }
            if (relativedAxis == null)
            {
                return;
            }
            if (m_SerieGrid == null)
            {
                return;
            }
            var dataZoom = chart.GetDataZoomOfAxis(axis);
            var showData = serie.GetDataList(dataZoom);

            if (showData.Count <= 0)
            {
                return;
            }

            var axisLength          = isY ? m_SerieGrid.context.height : m_SerieGrid.context.width;
            var relativedAxisLength = isY ? m_SerieGrid.context.width : m_SerieGrid.context.height;
            var axisXY = isY ? m_SerieGrid.context.y : m_SerieGrid.context.x;

            var isStack = SeriesHelper.IsStack <Bar>(chart.series, serie.stack);

            if (isStack)
            {
                SeriesHelper.UpdateStackDataList(chart.series, serie, dataZoom, m_StackSerieData);
            }

            var   barCount       = chart.GetSerieBarRealCount <Bar>();
            float categoryWidth  = AxisHelper.GetDataWidth(axis, axisLength, showData.Count, dataZoom);
            float barGap         = chart.GetSerieBarGap <Bar>();
            float totalBarWidth  = chart.GetSerieTotalWidth <Bar>(categoryWidth, barGap, barCount);
            float barWidth       = serie.GetBarWidth(categoryWidth, barCount);
            float offset         = (categoryWidth - totalBarWidth) * 0.5f;
            var   serieReadIndex = chart.GetSerieIndexIfStack <Bar>(serie);
            float gap            = serie.barGap == -1 ? offset : offset + chart.GetSerieTotalGap <Bar>(categoryWidth, barGap, serieReadIndex);
            int   maxCount       = serie.maxShow > 0 ?
                                   (serie.maxShow > showData.Count ? showData.Count : serie.maxShow) :
                                   showData.Count;
            var    isPercentStack     = SeriesHelper.IsPercentStack <Bar>(chart.series, serie.stack);
            bool   dataChanging       = false;
            float  dataChangeDuration = serie.animation.GetUpdateAnimationDuration();
            double yMinValue          = relativedAxis.context.minValue;
            double yMaxValue          = relativedAxis.context.maxValue;

            var areaColor   = ColorUtil.clearColor32;
            var areaToColor = ColorUtil.clearColor32;
            var interacting = false;

            serie.containerIndex       = m_SerieGrid.index;
            serie.containterInstanceId = m_SerieGrid.instanceId;
            serie.animation.InitProgress(axisXY, axisXY + axisLength);
            for (int i = serie.minShow; i < maxCount; i++)
            {
                var serieData = showData[i];
                serieData.index = i;
                if (!serieData.show || serie.IsIgnoreValue(serieData))
                {
                    serie.context.dataPoints.Add(Vector3.zero);
                    continue;
                }

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

                var highlight         = serieData.context.highlight || serie.highlight;
                var itemStyle         = SerieHelper.GetItemStyle(serie, serieData, highlight);
                var value             = axis.IsCategory() ? i : serieData.GetData(0, axis.inverse);
                var relativedValue    = serieData.GetCurrData(1, dataChangeDuration, relativedAxis.inverse, yMinValue, yMaxValue);
                var borderWidth       = relativedValue == 0 ? 0 : itemStyle.runtimeBorderWidth;
                var borderGap         = relativedValue == 0 ? 0 : itemStyle.borderGap;
                var borderGapAndWidth = borderWidth + borderGap;

                if (!serieData.interact.TryGetColor(ref areaColor, ref areaToColor, ref interacting))
                {
                    areaColor   = SerieHelper.GetItemColor(serie, serieData, chart.theme, colorIndex, highlight);
                    areaToColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, colorIndex, highlight);
                    serieData.interact.SetColor(ref interacting, areaColor, areaToColor);
                }

                var pX = 0f;
                var pY = 0f;
                UpdateXYPosition(m_SerieGrid, isY, axis, relativedAxis, i, categoryWidth, barWidth, isStack, value, ref pX, ref pY);
                var barHig = 0f;
                if (isPercentStack)
                {
                    var valueTotal = chart.GetSerieSameStackTotalValue <Bar>(serie.stack, i);
                    barHig = valueTotal != 0 ? (float)(relativedValue / valueTotal * relativedAxisLength) : 0;
                }
                else
                {
                    barHig = AxisHelper.GetAxisValueLength(m_SerieGrid, relativedAxis, categoryWidth, relativedValue);
                }

                float   currHig = AnimationStyleHelper.CheckDataAnimation(chart, serie, i, barHig);
                Vector3 plb, plt, prt, prb, top;
                UpdateRectPosition(m_SerieGrid, isY, relativedValue, pX, pY, gap, borderWidth, barWidth, currHig,
                                   out plb, out plt, out prt, out prb, out top);
                serieData.context.stackHeight = barHig;
                serieData.context.position    = top;
                serieData.context.rect        = Rect.MinMaxRect(plb.x + borderGapAndWidth, plb.y + borderGapAndWidth,
                                                                prt.x - borderGapAndWidth, prt.y - borderGapAndWidth);
                serieData.context.backgroundRect = isY ?
                                                   Rect.MinMaxRect(m_SerieGrid.context.x, plb.y, m_SerieGrid.context.x + relativedAxisLength, prt.y) :
                                                   Rect.MinMaxRect(plb.x, m_SerieGrid.context.y, prb.x, m_SerieGrid.context.y + relativedAxisLength);

                if (!serie.clip || (serie.clip && m_SerieGrid.Contains(top)))
                {
                    serie.context.dataPoints.Add(top);
                }
                else
                {
                    continue;
                }

                if (serie.show && currHig != 0 && !serie.placeHolder)
                {
                    switch (serie.barType)
                    {
                    case BarType.Normal:
                    case BarType.Capsule:
                        DrawNormalBar(vh, serie, serieData, itemStyle, colorIndex, highlight, gap, barWidth,
                                      pX, pY, plb, plt, prt, prb, isY, m_SerieGrid, axis, areaColor, areaToColor, relativedValue);
                        break;

                    case BarType.Zebra:
                        DrawZebraBar(vh, serie, serieData, itemStyle, colorIndex, highlight, gap, barWidth,
                                     pX, pY, plb, plt, prt, prb, isY, m_SerieGrid, axis, areaColor, areaToColor);
                        break;
                    }
                }
                if (serie.animation.CheckDetailBreak(top, isY))
                {
                    break;
                }
            }
            if (!serie.animation.IsFinish())
            {
                serie.animation.CheckProgress();
                chart.RefreshPainter(serie);
            }
            if (dataChanging || interacting)
            {
                chart.RefreshPainter(serie);
            }
        }