private void DrawPolarLine(VertexHelper vh, Serie serie) { var datas = serie.data; if (datas.Count <= 0) { return; } m_SeriePolar = chart.GetChartComponent <PolarCoord>(serie.polarIndex); if (m_SeriePolar == null) { return; } var m_AngleAxis = ComponentHelper.GetAngleAxis(chart.components, m_SeriePolar.index); var m_RadiusAxis = ComponentHelper.GetRadiusAxis(chart.components, m_SeriePolar.index); if (m_AngleAxis == null || m_RadiusAxis == null) { return; } var startAngle = m_AngleAxis.startAngle; var radius = m_SeriePolar.context.radius; var min = m_RadiusAxis.context.minValue; var max = m_RadiusAxis.context.maxValue; var firstSerieData = datas[0]; var lp = GetPolarPos(m_SeriePolar, m_AngleAxis, firstSerieData, min, max, radius); var cp = Vector3.zero; var lineColor = SerieHelper.GetLineColor(serie, null, chart.theme, serie.index, serie.highlight); var lineWidth = serie.lineStyle.GetWidth(chart.theme.serie.lineWidth); var currDetailProgress = 0f; var totalDetailProgress = datas.Count; serie.animation.InitProgress(currDetailProgress, totalDetailProgress); 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; bool bitp = true, bibp = true; for (int i = 1; i < datas.Count; i++) { if (serie.animation.CheckDetailBreak(i)) { break; } var serieData = datas[i]; cp = GetPolarPos(m_SeriePolar, m_AngleAxis, datas[i], min, max, radius); var np = i == datas.Count - 1 ? cp : GetPolarPos(m_SeriePolar, m_AngleAxis, datas[i + 1], min, max, radius); 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) { UGL.AddVertToVertexHelper(vh, ltp, lbp, lineColor, false); } if (bitp == bibp) { if (bitp) { UGL.AddVertToVertexHelper(vh, itp, ibp, lineColor, true); } else { UGL.AddVertToVertexHelper(vh, ltp, clp, lineColor, true); UGL.AddVertToVertexHelper(vh, ltp, crp, lineColor, true); } } else { if (bitp) { UGL.AddVertToVertexHelper(vh, itp, clp, lineColor, true); UGL.AddVertToVertexHelper(vh, itp, crp, lineColor, true); } else if (bibp) { UGL.AddVertToVertexHelper(vh, clp, ibp, lineColor, true); UGL.AddVertToVertexHelper(vh, crp, ibp, lineColor, true); } } lp = cp; } if (!serie.animation.IsFinish()) { serie.animation.CheckProgress(totalDetailProgress); serie.animation.CheckSymbol(serie.symbol.GetSize(null, chart.theme.serie.lineSymbolSize)); chart.RefreshChart(); } }
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; } } }