private void DrawSmoothAreaPoints(VertexHelper vh, int serieIndex, Serie serie, Axis xAxis, Vector3 lp, Vector3 np, int dataIndex, Color lineColor, Color areaColor, bool isStack) { bool isYAxis = xAxis is YAxis; if (isYAxis) { ChartHelper.GetBezierListVertical(ref smoothSegmentPoints, lp, np, m_Line.smoothStyle); } else { ChartHelper.GetBezierList(ref smoothSegmentPoints, lp, np, m_Line.smoothStyle); } Vector3 start, to; start = smoothSegmentPoints[0]; var smoothPoints = serie.GetSmoothList(dataIndex, smoothSegmentPoints.Count); smoothPoints.Clear(); var lastSerie = m_Series.GetSerie(serie.index - 1); var lastSmoothPoints = lastSerie != null?lastSerie.GetSmoothList(dataIndex, smoothSegmentPoints.Count) : new List <Vector3>(); smoothPoints.Add(start); var lastCount = 1; for (int k = 1; k < smoothSegmentPoints.Count; k++) { smoothPoints.Add(smoothSegmentPoints[k]); to = smoothSegmentPoints[k]; ChartHelper.DrawLine(vh, start, to, m_Line.tickness, lineColor); if (m_Line.area) { Vector3 alp, anp, tnp, tlp; if (isYAxis) { alp = new Vector3(start.x - m_Line.tickness, start.y); anp = new Vector3(to.x - m_Line.tickness, to.y); } else { alp = new Vector3(start.x, start.y - m_Line.tickness); anp = new Vector3(to.x, to.y - m_Line.tickness); } if (serieIndex > 0 && isStack) { if (k == smoothSegmentPoints.Count - 1) { if (k < lastSmoothPoints.Count - 1) { tnp = lastSmoothPoints[lastCount - 1]; if (isYAxis) { tnp.x += m_Line.tickness; } else { tnp.y += m_Line.tickness; } ChartHelper.DrawTriangle(vh, alp, anp, tnp, areaColor); while (lastCount < lastSmoothPoints.Count) { tlp = lastSmoothPoints[lastCount]; if (isYAxis) { tlp.x += m_Line.tickness; } else { tlp.y += m_Line.tickness; } ChartHelper.DrawTriangle(vh, tnp, anp, tlp, areaColor); lastCount++; tnp = tlp; } start = to; continue; } } if (lastCount >= lastSmoothPoints.Count) { tlp = lastSmoothPoints[lastSmoothPoints.Count - 1]; if (isYAxis) { tlp.x += m_Line.tickness; } else { tlp.y += m_Line.tickness; } ChartHelper.DrawTriangle(vh, anp, alp, tlp, areaColor); start = to; continue; } if (isYAxis) { tnp = new Vector3(lastSmoothPoints[lastCount].x + m_Line.tickness, lastSmoothPoints[lastCount].y); } else { tnp = new Vector3(lastSmoothPoints[lastCount].x, lastSmoothPoints[lastCount].y + m_Line.tickness); } var diff = isYAxis ? tnp.y - to.y : tnp.x - to.x; if (Math.Abs(diff) < 1) { if (isYAxis) { tlp = new Vector3(lastSmoothPoints[lastCount - 1].x + m_Line.tickness, lastSmoothPoints[lastCount - 1].y); } else { tlp = new Vector3(lastSmoothPoints[lastCount - 1].x, lastSmoothPoints[lastCount - 1].y + m_Line.tickness); } ChartHelper.DrawPolygon(vh, alp, anp, tnp, tlp, areaColor); lastCount++; } else { if (diff < 0) { if (isYAxis) { tnp = new Vector3(lastSmoothPoints[lastCount - 1].x + m_Line.tickness, lastSmoothPoints[lastCount - 1].y); } else { tnp = new Vector3(lastSmoothPoints[lastCount - 1].x, lastSmoothPoints[lastCount - 1].y + m_Line.tickness); } ChartHelper.DrawTriangle(vh, alp, anp, tnp, areaColor); while (diff < 0 && lastCount < lastSmoothPoints.Count) { if (isYAxis) { tlp = new Vector3(lastSmoothPoints[lastCount].x + m_Line.tickness, lastSmoothPoints[lastCount].y); } else { tlp = new Vector3(lastSmoothPoints[lastCount].x, lastSmoothPoints[lastCount].y + m_Line.tickness); } ChartHelper.DrawTriangle(vh, tnp, anp, tlp, areaColor); lastCount++; diff = isYAxis ? tlp.y - to.y : tlp.x - to.x; tnp = tlp; } } else { if (isYAxis) { tlp = new Vector3(lastSmoothPoints[lastCount - 1].x + m_Line.tickness, lastSmoothPoints[lastCount - 1].y); } else { tlp = new Vector3(lastSmoothPoints[lastCount - 1].x, lastSmoothPoints[lastCount - 1].y + m_Line.tickness); } ChartHelper.DrawTriangle(vh, alp, anp, tlp, areaColor); } } } else { if (isYAxis) { tnp = new Vector3(coordinateX + xAxis.axisLine.width, to.y); tlp = new Vector3(coordinateX + xAxis.axisLine.width, start.y); } else { tnp = new Vector3(to.x, coordinateY + xAxis.axisLine.width); tlp = new Vector3(start.x, coordinateY + xAxis.axisLine.width); } ChartHelper.DrawPolygon(vh, alp, anp, tnp, tlp, areaColor); } } start = to; } }