public static void DrawLineStyle(VertexHelper vh, LineStyle.Type lineType, float lineWidth, Vector3 startPos, Vector3 endPos, Color32 color, Color32 toColor) { switch (lineType) { case LineStyle.Type.Dashed: UGL.DrawDashLine(vh, startPos, endPos, lineWidth, color, toColor); break; case LineStyle.Type.Dotted: UGL.DrawDotLine(vh, startPos, endPos, lineWidth, color, toColor); break; case LineStyle.Type.Solid: UGL.DrawLine(vh, startPos, endPos, lineWidth, color, toColor); break; case LineStyle.Type.DashDot: UGL.DrawDashDotLine(vh, startPos, endPos, lineWidth, color); break; case LineStyle.Type.DashDotDot: UGL.DrawDashDotDotLine(vh, startPos, endPos, lineWidth, color); break; } }
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; } } }