protected void DrawXBarSerie(VertexHelper vh, Serie serie, int colorIndex, ref List <float> seriesHig)
        {
            if (!IsActive(serie.name))
            {
                return;
            }
            var showData = serie.GetDataList(m_DataZoom);
            var yAxis    = m_YAxises[serie.axisIndex];
            var xAxis    = m_XAxises[serie.axisIndex];

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

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

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

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

            for (int i = serie.minShow; i < maxCount; i++)
            {
                if (i >= seriesHig.Count)
                {
                    seriesHig.Add(0);
                }
                float value = showData[i].GetCurrData(1, updateDuration);
                if (showData[i].IsDataChanged())
                {
                    dataChanging = true;
                }
                float pX    = coordinateX + i * categoryWidth;
                float zeroY = coordinateY + yAxis.runtimeZeroYOffset;
                if (!xAxis.boundaryGap)
                {
                    pX -= categoryWidth / 2;
                }
                float pY = seriesHig[i] + zeroY + xAxis.axisLine.width;

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

                float currHig = CheckAnimation(serie, i, barHig);

                Vector3 p1 = new Vector3(pX + space, pY);
                Vector3 p2 = new Vector3(pX + space, pY + currHig);
                Vector3 p3 = new Vector3(pX + space + barWidth, pY + currHig);
                Vector3 p4 = new Vector3(pX + space + barWidth, pY);
                serie.dataPoints.Add(new Vector3(pX + space + barWidth / 2, pY + currHig));
                var highlight = (m_Tooltip.show && m_Tooltip.IsSelected(i)) ||
                                serie.data[i].highlighted ||
                                serie.highlighted;

                if (serie.show)
                {
                    Color areaColor   = serie.GetAreaColor(m_ThemeInfo, colorIndex, highlight);
                    Color areaToColor = serie.GetAreaToColor(m_ThemeInfo, colorIndex, highlight);
                    if (serie.barType == BarType.Zebra)
                    {
                        p1 = (p4 + p1) / 2;
                        p2 = (p2 + p3) / 2;
                        CheckClipAndDrawZebraLine(vh, p1, p2, barWidth / 2, serie.barZebraWidth, serie.barZebraGap,
                                                  areaColor, serie.clip);
                    }
                    else
                    {
                        CheckClipAndDrawPolygon(vh, p4, p1, p2, p3, areaColor, areaToColor, serie.clip);
                    }
                }
            }
            if (dataChanging)
            {
                RefreshChart();
            }
            if (!m_Series.IsStack(serie.stack, SerieType.Bar))
            {
                m_BarLastOffset += barGapWidth;
            }
        }
Esempio n. 2
0
        protected void DrawYBarSerie(VertexHelper vh, Serie serie, int colorIndex, ref List <float> seriesHig)
        {
            if (!IsActive(serie.name))
            {
                return;
            }
            var xAxis = m_XAxises[serie.axisIndex];
            var yAxis = m_YAxises[serie.axisIndex];

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

            var   showData      = serie.GetDataList(m_DataZoom);
            float categoryWidth = yAxis.GetDataWidth(coordinateHeight, showData.Count, m_DataZoom);
            float barGap        = GetBarGap();
            float totalBarWidth = GetBarTotalWidth(categoryWidth, barGap);
            float barWidth      = serie.GetBarWidth(categoryWidth);
            float offset        = (categoryWidth - totalBarWidth) / 2;
            float barGapWidth   = barWidth + barWidth * barGap;
            float space         = serie.barGap == -1 ? offset : offset + m_BarLastOffset;


            int maxCount = serie.maxShow > 0 ?
                           (serie.maxShow > showData.Count ? showData.Count : serie.maxShow)
                : showData.Count;

            if (seriesHig.Count < serie.minShow)
            {
                for (int i = 0; i < serie.minShow; i++)
                {
                    seriesHig.Add(0);
                }
            }
            var isPercentStack = m_Series.IsPercentStack(serie.stack, SerieType.Bar);

            for (int i = serie.minShow; i < maxCount; i++)
            {
                if (i >= seriesHig.Count)
                {
                    seriesHig.Add(0);
                }
                float value = showData[i].data[1];
                float pX    = seriesHig[i] + coordinateX + xAxis.zeroXOffset + yAxis.axisLine.width;
                float pY    = coordinateY + +i * categoryWidth;
                if (!yAxis.boundaryGap)
                {
                    pY -= categoryWidth / 2;
                }

                var barHig     = 0f;
                var valueTotal = 0f;
                if (isPercentStack)
                {
                    valueTotal    = GetSameStackTotalValue(serie.stack, i);
                    barHig        = value / valueTotal * coordinateWidth;
                    seriesHig[i] += barHig;
                }
                else
                {
                    valueTotal = xAxis.maxValue - xAxis.minValue;
                    barHig     = (xAxis.minValue > 0 ? value - xAxis.minValue : value)
                                 / valueTotal * coordinateWidth;
                    seriesHig[i] += barHig;
                }

                float currHig = CheckAnimation(serie, i, barHig);

                Vector3 p1 = new Vector3(pX, pY + space + barWidth);
                Vector3 p2 = new Vector3(pX + currHig, pY + space + barWidth);
                Vector3 p3 = new Vector3(pX + currHig, pY + space);
                Vector3 p4 = new Vector3(pX, pY + space);
                serie.dataPoints.Add(new Vector3(pX + currHig, pY + space + barWidth / 2));
                var highlight = (m_Tooltip.show && m_Tooltip.IsSelected(i)) ||
                                serie.data[i].highlighted ||
                                serie.highlighted;
                if (serie.show)
                {
                    Color areaColor   = serie.GetAreaColor(m_ThemeInfo, colorIndex, highlight);
                    Color areaToColor = serie.GetAreaToColor(m_ThemeInfo, colorIndex, highlight);
                    if (serie.barType == BarType.Zebra)
                    {
                        p1 = (p4 + p1) / 2;
                        p2 = (p2 + p3) / 2;
                        ChartDrawer.DrawZebraLine(vh, p1, p2, barWidth / 2, serie.barZebraWidth, serie.barZebraGap, areaColor);
                    }
                    else
                    {
                        ChartDrawer.DrawPolygon(vh, p4, p1, p2, p3, areaColor, areaToColor);
                    }
                }
            }
            if (!m_Series.IsStack(serie.stack, SerieType.Bar))
            {
                m_BarLastOffset += barGapWidth;
            }
        }
Esempio n. 3
0
        private void DrawYBarSerie(VertexHelper vh, int serieIndex, int stackCount,
                                   Serie serie, int colorIndex, ref List <float> seriesHig)
        {
            if (!IsActive(serie.name))
            {
                return;
            }
            var xAxis = m_XAxises[serie.axisIndex];
            var yAxis = m_YAxises[serie.axisIndex];

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

            float categoryWidth = yAxis.GetDataWidth(coordinateHig, m_DataZoom);
            float barGap        = GetBarGap();
            float totalBarWidth = GetBarTotalWidth(categoryWidth, barGap);
            float barWidth      = serie.GetBarWidth(categoryWidth);
            float offset        = (categoryWidth - totalBarWidth) / 2;
            float barGapWidth   = barWidth + barWidth * barGap;
            float space         = serie.barGap == -1 ? offset : offset + m_BarLastOffset;

            var showData = serie.GetDataList(m_DataZoom);
            int maxCount = maxShowDataNumber > 0 ?
                           (maxShowDataNumber > showData.Count ? showData.Count : maxShowDataNumber)
                : showData.Count;

            if (seriesHig.Count < minShowDataNumber)
            {
                for (int i = 0; i < minShowDataNumber; i++)
                {
                    seriesHig.Add(0);
                }
            }
            for (int i = minShowDataNumber; i < maxCount; i++)
            {
                if (i >= seriesHig.Count)
                {
                    seriesHig.Add(0);
                }
                float value = showData[i].data[1];
                float pX    = seriesHig[i] + coordinateX + xAxis.zeroXOffset + yAxis.axisLine.width;
                float pY    = coordinateY + +i * categoryWidth;
                if (!yAxis.boundaryGap)
                {
                    pY -= categoryWidth / 2;
                }
                float barHig = (xAxis.minValue > 0 ? value - xAxis.minValue : value)
                               / (xAxis.maxValue - xAxis.minValue) * coordinateWid;
                seriesHig[i] += barHig;
                Vector3 p1 = new Vector3(pX, pY + space + barWidth);
                Vector3 p2 = new Vector3(pX + barHig, pY + space + barWidth);
                Vector3 p3 = new Vector3(pX + barHig, pY + space);
                Vector3 p4 = new Vector3(pX, pY + space);
                serie.dataPoints.Add(new Vector3(pX + barHig, pY + space + barWidth / 2));
                var highlight = (m_Tooltip.show && m_Tooltip.IsSelected(i)) ||
                                serie.data[i].highlighted ||
                                serie.highlighted;
                if (serie.show)
                {
                    Color areaColor   = serie.GetAreaColor(m_ThemeInfo, colorIndex, highlight);
                    Color areaToColor = serie.GetAreaToColor(m_ThemeInfo, colorIndex, highlight);
                    ChartHelper.DrawPolygon(vh, p1, p2, p3, p4, areaColor, areaToColor);
                }
            }
            if (!m_Series.IsStack(serie.stack, SerieType.Bar))
            {
                m_BarLastOffset += barGapWidth;
            }
        }
        protected void DrawXBarSerie(VertexHelper vh, Serie serie, int colorIndex, ref List <float> seriesHig)
        {
            if (!IsActive(serie.name))
            {
                return;
            }
            var showData = serie.GetDataList(m_DataZoom);
            var yAxis    = m_YAxises[serie.axisIndex];
            var xAxis    = m_XAxises[serie.axisIndex];

            if (!xAxis.show)
            {
                xAxis = m_XAxises[(serie.axisIndex + 1) % m_XAxises.Count];
            }
            float categoryWidth = xAxis.GetDataWidth(coordinateWidth, m_DataZoom);
            float barGap        = GetBarGap();
            float totalBarWidth = GetBarTotalWidth(categoryWidth, barGap);
            float barWidth      = serie.GetBarWidth(categoryWidth);
            float offset        = (categoryWidth - totalBarWidth) / 2;
            float barGapWidth   = barWidth + barWidth * barGap;
            float space         = serie.barGap == -1 ? offset : offset + m_BarLastOffset;
            int   maxCount      = serie.maxShow > 0 ?
                                  (serie.maxShow > showData.Count ? showData.Count : serie.maxShow)
                : showData.Count;

            if (seriesHig.Count < serie.minShow)
            {
                for (int i = 0; i < serie.minShow; i++)
                {
                    seriesHig.Add(0);
                }
            }
            for (int i = serie.minShow; i < maxCount; i++)
            {
                if (i >= seriesHig.Count)
                {
                    seriesHig.Add(0);
                }
                float value = showData[i].data[1];
                float pX    = coordinateX + i * categoryWidth;
                float zeroY = coordinateY + yAxis.zeroYOffset;
                if (!xAxis.boundaryGap)
                {
                    pX -= categoryWidth / 2;
                }
                float pY     = seriesHig[i] + zeroY + xAxis.axisLine.width;
                float barHig = (yAxis.minValue > 0 ? value - yAxis.minValue : value)
                               / (yAxis.maxValue - yAxis.minValue) * coordinateHeight;
                seriesHig[i] += barHig;

                float currHig = CheckAnimation(serie, i, barHig);

                Vector3 p1 = new Vector3(pX + space, pY);
                Vector3 p2 = new Vector3(pX + space, pY + currHig);
                Vector3 p3 = new Vector3(pX + space + barWidth, pY + currHig);
                Vector3 p4 = new Vector3(pX + space + barWidth, pY);
                serie.dataPoints.Add(new Vector3(pX + space + barWidth / 2, pY + currHig));
                var highlight = (m_Tooltip.show && m_Tooltip.IsSelected(i)) ||
                                serie.data[i].highlighted ||
                                serie.highlighted;

                if (serie.show)
                {
                    Color areaColor   = serie.GetAreaColor(m_ThemeInfo, colorIndex, highlight);
                    Color areaToColor = serie.GetAreaToColor(m_ThemeInfo, colorIndex, highlight);
                    ChartDrawer.DrawPolygon(vh, p4, p1, p2, p3, areaColor, areaToColor);
                }
            }
            if (!m_Series.IsStack(serie.stack, SerieType.Bar))
            {
                m_BarLastOffset += barGapWidth;
            }
        }
Esempio n. 5
0
        private void DrawYLineSerie(VertexHelper vh, int serieIndex, Serie serie, ref List <float> seriesHig)
        {
            if (!IsActive(serie.index))
            {
                return;
            }
            var     showData    = serie.GetDataList(m_DataZoom);
            Vector3 lp          = Vector3.zero;
            Vector3 np          = Vector3.zero;
            Vector3 nnp         = Vector3.zero;
            Color   lineColor   = serie.GetLineColor(m_ThemeInfo, serieIndex, false);
            Color   areaColor   = serie.GetAreaColor(m_ThemeInfo, serieIndex, false);
            Color   areaToColor = serie.GetAreaToColor(m_ThemeInfo, serieIndex, false);
            var     xAxis       = m_XAxises[serie.axisIndex];
            var     yAxis       = m_YAxises[serie.axisIndex];
            var     zeroPos     = new Vector3(coordinateX + xAxis.zeroXOffset, coordinateY);
            var     lastSerie   = m_Series.GetSerie(serieIndex - 1);
            var     isStack     = m_Series.IsStack(serie.stack, SerieType.Line);

            if (!yAxis.show)
            {
                yAxis = m_YAxises[(serie.axisIndex + 1) % m_YAxises.Count];
            }
            float scaleWid = yAxis.GetDataWidth(coordinateHig, m_DataZoom);
            float startY   = coordinateY + (yAxis.boundaryGap ? scaleWid / 2 : 0);
            int   maxCount = maxShowDataNumber > 0 ?
                             (maxShowDataNumber > showData.Count ? showData.Count : maxShowDataNumber)
                : showData.Count;

            if (seriesHig.Count < minShowDataNumber)
            {
                for (int i = 0; i < minShowDataNumber; i++)
                {
                    seriesHig.Add(0);
                }
            }
            for (int i = minShowDataNumber; i < maxCount; i++)
            {
                if (i >= seriesHig.Count)
                {
                    seriesHig.Add(0);
                }
                float value   = showData[i].data[1];
                float pY      = startY + i * scaleWid;
                float pX      = seriesHig[i] + coordinateX + yAxis.axisLine.width;
                float dataHig = (value - xAxis.minValue) / (xAxis.maxValue - xAxis.minValue) * coordinateWid;
                np = new Vector3(pX + dataHig, pY);
                serie.dataPoints.Add(np);
                seriesHig[i] += dataHig;
                lp            = np;
            }

            lp = serie.dataPoints[0];
            for (int i = 1; i < serie.dataPoints.Count; i++)
            {
                np = serie.dataPoints[i];
                serie.ClearSmoothList(i);
                switch (serie.lineType)
                {
                case LineType.Normal:
                    nnp = i < serie.dataPoints.Count - 1 ? serie.dataPoints[i + 1] : np;
                    DrawNormalLine(vh, serieIndex, serie, yAxis, lp, np, nnp, i, lineColor, areaColor, areaToColor, zeroPos);
                    break;

                case LineType.Smooth:
                    DrawSmoothLine(vh, serieIndex, serie, yAxis, lp, np, i, lineColor, areaColor, areaToColor, isStack, zeroPos);
                    break;

                case LineType.StepStart:
                case LineType.StepMiddle:
                case LineType.StepEnd:
                    DrawStepLine(vh, serieIndex, serie, yAxis, lp, np, i, lineColor, areaColor, zeroPos);
                    break;
                }
                lp = np;
            }
        }
Esempio n. 6
0
        private void DrawXLineSerie(VertexHelper vh, int serieIndex, Serie serie, ref List <float> seriesHig)
        {
            if (!IsActive(serie.index))
            {
                return;
            }
            var showData = serie.GetDataList(m_DataZoom);

            if (showData.Count <= 0)
            {
                return;
            }
            Color   lineColor = serie.GetLineColor(m_ThemeInfo, serieIndex, false);
            Color   areaColor = serie.GetAreaColor(m_ThemeInfo, serieIndex, false);
            Color   areaToColor = serie.GetAreaToColor(m_ThemeInfo, serieIndex, false);
            Vector3 lp = Vector3.zero, np = Vector3.zero, nnp = Vector3.zero;
            var     yAxis     = m_YAxises[serie.axisIndex];
            var     xAxis     = m_XAxises[serie.axisIndex];
            var     zeroPos   = new Vector3(coordinateX, coordinateY + yAxis.zeroYOffset);
            var     lastSerie = m_Series.GetSerie(serie.index - 1);
            var     isStack   = m_Series.IsStack(serie.stack, SerieType.Line);

            if (!xAxis.show)
            {
                xAxis = m_XAxises[(serie.axisIndex + 1) % m_XAxises.Count];
            }
            float scaleWid = xAxis.GetDataWidth(coordinateWid, m_DataZoom);
            float startX   = coordinateX + (xAxis.boundaryGap ? scaleWid / 2 : 0);
            int   maxCount = maxShowDataNumber > 0 ?
                             (maxShowDataNumber > showData.Count ? showData.Count : maxShowDataNumber)
                : showData.Count;

            if (seriesHig.Count < minShowDataNumber)
            {
                for (int i = 0; i < minShowDataNumber; i++)
                {
                    seriesHig.Add(0);
                }
            }
            for (int i = minShowDataNumber; i < maxCount; i++)
            {
                if (i >= seriesHig.Count)
                {
                    seriesHig.Add(0);
                }
                float yValue = showData[i].data[1];
                seriesHig[i] += GetDataPoint(xAxis, yAxis, showData, yValue, startX, i, scaleWid, seriesHig[i], ref np);
                serie.dataPoints.Add(np);
                lp = np;
            }
            if (serie.dataPoints.Count <= 0)
            {
                return;
            }
            lp = serie.dataPoints[0];
            for (int i = 1; i < serie.dataPoints.Count; i++)
            {
                np = serie.dataPoints[i];
                serie.ClearSmoothList(i);
                switch (serie.lineType)
                {
                case LineType.Normal:
                    nnp = i < serie.dataPoints.Count - 1 ? serie.dataPoints[i + 1] : np;
                    DrawNormalLine(vh, serieIndex, serie, xAxis, lp, np, nnp, i, lineColor, areaColor, areaToColor, zeroPos);
                    break;

                case LineType.Smooth:
                    DrawSmoothLine(vh, serieIndex, serie, xAxis, lp, np, i, lineColor, areaColor, areaToColor, isStack, zeroPos);
                    break;

                case LineType.StepStart:
                case LineType.StepMiddle:
                case LineType.StepEnd:
                    DrawStepLine(vh, serieIndex, serie, xAxis, lp, np, i, lineColor, areaColor, zeroPos);
                    break;
                }
                lp = np;
            }
        }
Esempio n. 7
0
        protected void DrawYBarSerie(VertexHelper vh, Serie serie, int colorIndex, ref List <float> seriesHig)
        {
            if (!IsActive(serie.name))
            {
                return;
            }
            if (serie.animation.HasFadeOut())
            {
                return;
            }
            var xAxis = m_XAxises[serie.axisIndex];
            var yAxis = m_YAxises[serie.axisIndex];

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

            var   showData      = serie.GetDataList(m_DataZoom);
            float categoryWidth = yAxis.GetDataWidth(coordinateHeight, showData.Count, m_DataZoom);
            float barGap        = GetBarGap();
            float totalBarWidth = GetBarTotalWidth(categoryWidth, barGap);
            float barWidth      = serie.GetBarWidth(categoryWidth);
            float offset        = (categoryWidth - totalBarWidth) / 2;
            float barGapWidth   = barWidth + barWidth * barGap;
            float space         = serie.barGap == -1 ? offset : offset + m_BarLastOffset;


            int maxCount = serie.maxShow > 0 ?
                           (serie.maxShow > showData.Count ? showData.Count : serie.maxShow)
                : showData.Count;

            if (seriesHig.Count < serie.minShow)
            {
                for (int i = 0; i < serie.minShow; i++)
                {
                    seriesHig.Add(0);
                }
            }
            var   isPercentStack     = m_Series.IsPercentStack(serie.stack, SerieType.Bar);
            bool  dataChanging       = false;
            float dataChangeDuration = serie.animation.GetUpdateAnimationDuration();
            float xMinValue          = xAxis.GetCurrMinValue(dataChangeDuration);
            float xMaxValue          = xAxis.GetCurrMaxValue(dataChangeDuration);
            float borderWidth        = serie.itemStyle.runtimeBorderWidth;

            for (int i = serie.minShow; i < maxCount; i++)
            {
                if (i >= seriesHig.Count)
                {
                    seriesHig.Add(0);
                }
                var serieData = showData[i];
                serieData.canShowLabel = true;
                float value = showData[i].GetCurrData(1, dataChangeDuration);
                if (showData[i].IsDataChanged())
                {
                    dataChanging = true;
                }
                float pX = seriesHig[i] + coordinateX + xAxis.runtimeZeroXOffset + yAxis.axisLine.width;
                float pY = coordinateY + +i * categoryWidth;
                if (!yAxis.boundaryGap)
                {
                    pY -= categoryWidth / 2;
                }

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

                float currHig = CheckAnimation(serie, i, barHig);

                Vector3 p1  = new Vector3(pX + borderWidth, pY + space + barWidth - borderWidth);
                Vector3 p2  = new Vector3(pX + currHig - 2 * borderWidth, pY + space + barWidth - borderWidth);
                Vector3 p3  = new Vector3(pX + currHig - 2 * borderWidth, pY + space + borderWidth);
                Vector3 p4  = new Vector3(pX + borderWidth, pY + space + borderWidth);
                Vector3 top = new Vector3(pX + currHig - borderWidth, pY + space + barWidth / 2);
                p1  = ClampInCoordinate(p1);
                p2  = ClampInCoordinate(p2);
                p3  = ClampInCoordinate(p3);
                p4  = ClampInCoordinate(p4);
                top = ClampInCoordinate(top);
                serie.dataPoints.Add(top);
                var highlight = (m_Tooltip.show && m_Tooltip.IsSelected(i)) ||
                                serie.data[i].highlighted ||
                                serie.highlighted;
                if (serie.show)
                {
                    Color areaColor   = serie.GetAreaColor(m_ThemeInfo, colorIndex, highlight);
                    Color areaToColor = serie.GetAreaToColor(m_ThemeInfo, colorIndex, highlight);
                    if (serie.barType == BarType.Zebra)
                    {
                        p1 = (p4 + p1) / 2;
                        p2 = (p2 + p3) / 2;
                        CheckClipAndDrawZebraLine(vh, p1, p2, barWidth / 2, serie.barZebraWidth, serie.barZebraGap,
                                                  areaColor, serie.clip);
                    }
                    else
                    {
                        CheckClipAndDrawPolygon(vh, p4, p1, p2, p3, areaColor, areaToColor, serie.clip);
                        if (borderWidth > 0)
                        {
                            var borderColor = serie.itemStyle.borderColor;
                            var itemWidth   = Mathf.Abs(p3.x - p1.x);
                            var itemHeight  = Mathf.Abs(p2.y - p4.y);
                            var center      = new Vector3((p1.x + p3.x) / 2, (p2.y + p4.y) / 2);
                            ChartDrawer.DrawBorder(vh, center, itemWidth, itemHeight, borderWidth, borderColor);
                        }
                    }
                }
            }
            if (!m_Series.IsStack(serie.stack, SerieType.Bar))
            {
                m_BarLastOffset += barGapWidth;
            }
            if (dataChanging)
            {
                RefreshChart();
            }
        }