protected void DrawLineStyle(VertexHelper vh, LineStyle lineStyle, Vector3 startPos, Vector3 endPos, Color color) { var type = lineStyle.type; var width = lineStyle.width; switch (type) { case LineStyle.Type.Dashed: ChartDrawer.DrawDashLine(vh, startPos, endPos, width, color); break; case LineStyle.Type.Dotted: ChartDrawer.DrawDotLine(vh, startPos, endPos, width, color); break; case LineStyle.Type.Solid: ChartDrawer.DrawLine(vh, startPos, endPos, width, color); break; case LineStyle.Type.DashDot: ChartDrawer.DrawDashDotLine(vh, startPos, endPos, width, color); break; case LineStyle.Type.DashDotDot: ChartDrawer.DrawDashDotDotLine(vh, startPos, endPos, width, color); break; } }
private void DrawAxisTick(VertexHelper vh, Serie serie) { if (serie.gaugeType != GaugeType.Pointer) { return; } if (!serie.gaugeAxis.show || !serie.gaugeAxis.axisTick.show) { return; } if (serie.splitNumber <= 0) { return; } var axisTick = serie.gaugeAxis.axisTick; var totalAngle = serie.endAngle - serie.startAngle; var diffAngle = totalAngle / serie.splitNumber; var outsideRadius = serie.runtimeInsideRadius + serie.gaugeAxis.axisLine.width; var insideRadius = outsideRadius - (axisTick.length < 1 ? serie.gaugeAxis.axisLine.width * axisTick.length : axisTick.length); var lineWidth = axisTick.lineStyle.width; for (int i = 0; i < serie.splitNumber; i++) { for (int j = 1; j < axisTick.splitNumber; j++) { var angle = serie.startAngle + i * diffAngle + j * (diffAngle / axisTick.splitNumber); var lineColor = serie.gaugeAxis.GetSplitLineColor(m_ThemeInfo, serie.index, angle); var p1 = ChartHelper.GetPosition(serie.runtimeCenterPos, angle, insideRadius); var p2 = ChartHelper.GetPosition(serie.runtimeCenterPos, angle, outsideRadius); ChartDrawer.DrawLine(vh, p1, p2, lineWidth, lineColor); } } }
private void DrawAngleAxis(VertexHelper vh) { var radius = m_Polar.runtimeRadius; var cenPos = m_Polar.runtimeCenterPos; var total = 360; var size = AxisHelper.GetScaleNumber(m_AngleAxis, total, null); var currAngle = m_AngleAxis.runtimeStartAngle; var tickWidth = AxisHelper.GetTickWidth(m_AngleAxis); for (int i = 0; i < size; i++) { var scaleWidth = AxisHelper.GetScaleWidth(m_AngleAxis, total, i); var pos = ChartHelper.GetPos(cenPos, radius, currAngle, true); if (m_AngleAxis.show && m_AngleAxis.splitLine.show) { var splitLineColor = m_AngleAxis.splitLine.GetColor(m_ThemeInfo); ChartDrawer.DrawLine(vh, cenPos, pos, m_AngleAxis.splitLine.lineStyle.width, splitLineColor); } if (m_AngleAxis.show && m_AngleAxis.axisTick.show) { var tickPos = ChartHelper.GetPos(cenPos, radius + m_AngleAxis.axisTick.length, currAngle, true); ChartDrawer.DrawLine(vh, pos, tickPos, tickWidth, m_ThemeInfo.axisLineColor); } currAngle += scaleWidth; } if (m_AngleAxis.show && m_AngleAxis.axisLine.show) { var outsideRaidus = radius + m_AngleAxis.axisLine.width * 2; ChartDrawer.DrawDoughnut(vh, cenPos, radius, outsideRaidus, m_ThemeInfo.axisLineColor, Color.clear); } }
private void DrawRadiusAxis(VertexHelper vh) { var startAngle = m_AngleAxis.runtimeStartAngle; var radius = m_Polar.runtimeRadius; var cenPos = m_Polar.runtimeCenterPos; var size = AxisHelper.GetScaleNumber(m_RadiusAxis, radius, null); var totalWidth = 0f; var dire = ChartHelper.GetDire(startAngle, true).normalized; var tickVetor = ChartHelper.GetVertialDire(dire) * m_RadiusAxis.axisTick.length; var tickWidth = AxisHelper.GetTickWidth(m_RadiusAxis); for (int i = 0; i < size; i++) { var scaleWidth = AxisHelper.GetScaleWidth(m_RadiusAxis, radius, i); var pos = ChartHelper.GetPos(cenPos, totalWidth, startAngle, true); if (m_RadiusAxis.show && m_RadiusAxis.splitLine.show) { var outsideRaidus = totalWidth + m_RadiusAxis.splitLine.lineStyle.width * 2; var splitLineColor = m_RadiusAxis.splitLine.GetColor(m_ThemeInfo); ChartDrawer.DrawDoughnut(vh, cenPos, totalWidth, outsideRaidus, splitLineColor, Color.clear); } if (m_RadiusAxis.show && m_RadiusAxis.axisTick.show) { ChartDrawer.DrawLine(vh, pos, pos + tickVetor, tickWidth, m_ThemeInfo.axisLineColor); } totalWidth += scaleWidth; } if (m_RadiusAxis.show && m_RadiusAxis.axisLine.show) { var lineStartPos = m_Polar.runtimeCenterPos - dire * m_RadiusAxis.axisTick.width; var lineEndPos = m_Polar.runtimeCenterPos + dire * (radius + m_RadiusAxis.axisTick.width); ChartDrawer.DrawLine(vh, lineStartPos, lineEndPos, m_RadiusAxis.axisLine.width, m_ThemeInfo.axisLineColor); } }
private void DrawRadar(VertexHelper vh, Radar radar) { if (!radar.lineStyle.show && !radar.splitArea.show) { return; } float insideRadius = 0, outsideRadius = 0; float block = radar.actualRadius / radar.splitNumber; int indicatorNum = radar.indicatorList.Count; Vector3 p1, p2, p3, p4; Vector3 p = radar.centerPos; float angle = 2 * Mathf.PI / indicatorNum; var lineColor = GetLineColor(radar); for (int i = 0; i < radar.splitNumber; i++) { Color color = radar.splitArea.color[i % radar.splitArea.color.Count]; outsideRadius = insideRadius + block; p1 = new Vector3(p.x + insideRadius * Mathf.Sin(0), p.y + insideRadius * Mathf.Cos(0)); p2 = new Vector3(p.x + outsideRadius * Mathf.Sin(0), p.y + outsideRadius * Mathf.Cos(0)); for (int j = 0; j <= indicatorNum; j++) { float currAngle = j * angle; p3 = new Vector3(p.x + outsideRadius * Mathf.Sin(currAngle), p.y + outsideRadius * Mathf.Cos(currAngle)); p4 = new Vector3(p.x + insideRadius * Mathf.Sin(currAngle), p.y + insideRadius * Mathf.Cos(currAngle)); if (radar.splitArea.show) { ChartDrawer.DrawPolygon(vh, p1, p2, p3, p4, color); } if (radar.lineStyle.show) { ChartDrawer.DrawLine(vh, p2, p3, radar.lineStyle.width, lineColor); } p1 = p4; p2 = p3; } insideRadius = outsideRadius; } for (int j = 0; j <= indicatorNum; j++) { float currAngle = j * angle; p3 = new Vector3(p.x + outsideRadius * Mathf.Sin(currAngle), p.y + outsideRadius * Mathf.Cos(currAngle)); if (radar.lineStyle.show) { ChartDrawer.DrawLine(vh, p, p3, radar.lineStyle.width / 2, lineColor); } } }
protected void DrawLabelBackground(VertexHelper vh, Serie serie, SerieData serieData) { var labelHalfWid = serieData.GetLabelWidth() / 2; var labelHalfHig = serieData.GetLabelHeight() / 2; var serieLabel = serieData.GetSerieLabel(serie.label); var centerPos = serieData.labelPosition + serieLabel.offset; var p1 = new Vector3(centerPos.x - labelHalfWid, centerPos.y + labelHalfHig); var p2 = new Vector3(centerPos.x + labelHalfWid, centerPos.y + labelHalfHig); var p3 = new Vector3(centerPos.x + labelHalfWid, centerPos.y - labelHalfHig); var p4 = new Vector3(centerPos.x - labelHalfWid, centerPos.y - labelHalfHig); if (serieLabel.rotate > 0) { p1 = ChartHelper.RotateRound(p1, centerPos, Vector3.forward, serieLabel.rotate); p2 = ChartHelper.RotateRound(p2, centerPos, Vector3.forward, serieLabel.rotate); p3 = ChartHelper.RotateRound(p3, centerPos, Vector3.forward, serieLabel.rotate); p4 = ChartHelper.RotateRound(p4, centerPos, Vector3.forward, serieLabel.rotate); } ChartDrawer.DrawPolygon(vh, p1, p2, p3, p4, serieLabel.backgroundColor); if (serieLabel.border) { var borderWid = serieLabel.borderWidth; p1 = new Vector3(centerPos.x - labelHalfWid, centerPos.y + labelHalfHig + borderWid); p2 = new Vector3(centerPos.x + labelHalfWid + 2 * borderWid, centerPos.y + labelHalfHig + borderWid); p3 = new Vector3(centerPos.x + labelHalfWid + borderWid, centerPos.y + labelHalfHig); p4 = new Vector3(centerPos.x + labelHalfWid + borderWid, centerPos.y - labelHalfHig - 2 * borderWid); var p5 = new Vector3(centerPos.x + labelHalfWid, centerPos.y - labelHalfHig - borderWid); var p6 = new Vector3(centerPos.x - labelHalfWid - 2 * borderWid, centerPos.y - labelHalfHig - borderWid); var p7 = new Vector3(centerPos.x - labelHalfWid - borderWid, centerPos.y - labelHalfHig); var p8 = new Vector3(centerPos.x - labelHalfWid - borderWid, centerPos.y + labelHalfHig + 2 * borderWid); if (serieLabel.rotate > 0) { p1 = ChartHelper.RotateRound(p1, centerPos, Vector3.forward, serieLabel.rotate); p2 = ChartHelper.RotateRound(p2, centerPos, Vector3.forward, serieLabel.rotate); p3 = ChartHelper.RotateRound(p3, centerPos, Vector3.forward, serieLabel.rotate); p4 = ChartHelper.RotateRound(p4, centerPos, Vector3.forward, serieLabel.rotate); p5 = ChartHelper.RotateRound(p5, centerPos, Vector3.forward, serieLabel.rotate); p6 = ChartHelper.RotateRound(p6, centerPos, Vector3.forward, serieLabel.rotate); p7 = ChartHelper.RotateRound(p7, centerPos, Vector3.forward, serieLabel.rotate); p8 = ChartHelper.RotateRound(p8, centerPos, Vector3.forward, serieLabel.rotate); } ChartDrawer.DrawLine(vh, p1, p2, borderWid, serieLabel.borderColor); ChartDrawer.DrawLine(vh, p3, p4, borderWid, serieLabel.borderColor); ChartDrawer.DrawLine(vh, p5, p6, borderWid, serieLabel.borderColor); ChartDrawer.DrawLine(vh, p7, p8, borderWid, serieLabel.borderColor); } }
private void DrawPolarLine(VertexHelper vh, Serie serie) { var startAngle = m_AngleAxis.runtimeStartAngle; var radius = m_Polar.runtimeRadius; var datas = serie.data; if (datas.Count <= 0) { return; } float dataChangeDuration = serie.animation.GetUpdateAnimationDuration(); float min = m_RadiusAxis.GetCurrMinValue(dataChangeDuration); float max = m_RadiusAxis.GetCurrMaxValue(dataChangeDuration); var firstSerieData = datas[0]; var startPos = GetPolarPos(firstSerieData, min, max, radius); var nextPos = Vector3.zero; var lineColor = SerieHelper.GetLineColor(serie, m_ThemeInfo, serie.index, serie.highlighted); var lineWidth = serie.lineStyle.width; float currDetailProgress = 0; float totalDetailProgress = datas.Count; serie.animation.InitProgress(serie.dataPoints.Count, currDetailProgress, totalDetailProgress); serie.animation.SetDataFinish(0); for (int i = 1; i < datas.Count; i++) { if (serie.animation.CheckDetailBreak(i)) { break; } var serieData = datas[i]; nextPos = GetPolarPos(datas[i], min, max, radius); ChartDrawer.DrawLine(vh, startPos, nextPos, lineWidth, lineColor); startPos = nextPos; } if (!serie.animation.IsFinish()) { serie.animation.CheckProgress(totalDetailProgress); serie.animation.CheckSymbol(serie.symbol.size); m_IsPlayingAnimation = true; RefreshChart(); } }
private void DrawCricleRadar(VertexHelper vh, Radar radar) { if (!radar.splitLine.show && !radar.splitArea.show) { return; } float insideRadius = 0, outsideRadius = 0; float block = radar.runtimeRadius / radar.splitNumber; int indicatorNum = radar.indicatorList.Count; Vector3 p = radar.runtimeCenterPos; Vector3 p1; float angle = 2 * Mathf.PI / indicatorNum; var lineColor = GetLineColor(radar); for (int i = 0; i < radar.splitNumber; i++) { Color color = radar.splitArea.color[i % radar.splitArea.color.Count]; outsideRadius = insideRadius + block; if (radar.splitArea.show) { ChartDrawer.DrawDoughnut(vh, p, insideRadius, outsideRadius, color, Color.clear, 0, 360, m_Settings.cicleSmoothness); } if (radar.splitLine.show) { ChartDrawer.DrawEmptyCricle(vh, p, outsideRadius, radar.splitLine.lineStyle.width, lineColor, Color.clear, m_Settings.cicleSmoothness); } insideRadius = outsideRadius; } for (int j = 0; j <= indicatorNum; j++) { float currAngle = j * angle; p1 = new Vector3(p.x + outsideRadius * Mathf.Sin(currAngle), p.y + outsideRadius * Mathf.Cos(currAngle)); if (radar.splitLine.show) { ChartDrawer.DrawLine(vh, p, p1, radar.splitLine.lineStyle.width / 2, lineColor); } } }
void Awake() { chart = gameObject.GetComponent <LineChart>(); if (chart == null) { return; } chart.customDrawCallback = delegate(VertexHelper vh) { var dataPoints = chart.series.list[0].dataPoints; if (dataPoints.Count > 0) { var pos = dataPoints[3]; var zeroPos = new Vector3(chart.coordinateX, chart.coordinateY); var startPos = new Vector3(pos.x, zeroPos.y); var endPos = new Vector3(pos.x, zeroPos.y + chart.coordinateHeight); ChartDrawer.DrawLine(vh, startPos, endPos, 1, Color.blue); ChartDrawer.DrawCricle(vh, pos, 5, Color.blue); } }; }
private void DrawLabelLine(VertexHelper vh, Serie serie, SerieData serieData, Color color) { if (serie.label.show && serie.label.position == SerieLabel.Position.Outside && serie.label.line) { var insideRadius = serieData.runtimePieInsideRadius; var outSideRadius = serieData.runtimePieOutsideRadius; var center = serie.runtimePieCenterPos; var currAngle = serieData.runtimePieHalfAngle; if (serie.label.lineColor != Color.clear) { color = serie.label.lineColor; } else if (serie.label.lineType == SerieLabel.LineType.HorizontalLine) { color *= color; } float currSin = Mathf.Sin(currAngle * Mathf.Deg2Rad); float currCos = Mathf.Cos(currAngle * Mathf.Deg2Rad); var radius1 = serie.label.lineType == SerieLabel.LineType.HorizontalLine ? serie.runtimePieOutsideRadius : outSideRadius; var radius2 = serie.runtimePieOutsideRadius + serie.label.lineLength1; var radius3 = insideRadius + (outSideRadius - insideRadius) / 2; if (radius1 < serie.runtimePieInsideRadius) { radius1 = serie.runtimePieInsideRadius; } radius1 -= 0.1f; var pos0 = new Vector3(center.x + radius3 * currSin, center.y + radius3 * currCos); var pos1 = new Vector3(center.x + radius1 * currSin, center.y + radius1 * currCos); var pos2 = new Vector3(center.x + radius2 * currSin, center.y + radius2 * currCos); float tx, ty; Vector3 pos3, pos4, pos6; var horizontalLineCircleRadius = serie.label.lineWidth * 4f; var lineCircleDiff = horizontalLineCircleRadius - 0.3f; if (currAngle < 90) { ty = serie.label.lineWidth * Mathf.Cos((90 - currAngle) * Mathf.Deg2Rad); tx = serie.label.lineWidth * Mathf.Sin((90 - currAngle) * Mathf.Deg2Rad); pos3 = new Vector3(pos2.x - tx, pos2.y + ty - serie.label.lineWidth); var r4 = Mathf.Sqrt(radius1 * radius1 - Mathf.Pow(currCos * radius3, 2)) - currSin * radius3; r4 += serie.label.lineLength1 - lineCircleDiff; pos6 = pos0 + Vector3.right * lineCircleDiff; pos4 = pos6 + Vector3.right * r4; } else if (currAngle < 180) { ty = serie.label.lineWidth * Mathf.Sin((180 - currAngle) * Mathf.Deg2Rad); tx = serie.label.lineWidth * Mathf.Cos((180 - currAngle) * Mathf.Deg2Rad); pos3 = new Vector3(pos2.x - tx, pos2.y - ty + serie.label.lineWidth); var r4 = Mathf.Sqrt(radius1 * radius1 - Mathf.Pow(currCos * radius3, 2)) - currSin * radius3; r4 += serie.label.lineLength1 - lineCircleDiff; pos6 = pos0 + Vector3.right * lineCircleDiff; pos4 = pos6 + Vector3.right * r4; } else if (currAngle < 270) { ty = serie.label.lineWidth * Mathf.Sin((180 + currAngle) * Mathf.Deg2Rad); tx = serie.label.lineWidth * Mathf.Cos((180 + currAngle) * Mathf.Deg2Rad); var currSin1 = Mathf.Sin((360 - currAngle) * Mathf.Deg2Rad); var currCos1 = Mathf.Cos((360 - currAngle) * Mathf.Deg2Rad); pos3 = new Vector3(pos2.x + tx, pos2.y - ty + serie.label.lineWidth); var r4 = Mathf.Sqrt(radius1 * radius1 - Mathf.Pow(currCos1 * radius3, 2)) - currSin1 * radius3; r4 += serie.label.lineLength1 - lineCircleDiff; pos6 = pos0 + Vector3.left * lineCircleDiff; pos4 = pos6 + Vector3.left * r4; } else { ty = serie.label.lineWidth * Mathf.Cos((90 + currAngle) * Mathf.Deg2Rad); tx = serie.label.lineWidth * Mathf.Sin((90 + currAngle) * Mathf.Deg2Rad); pos3 = new Vector3(pos2.x + tx, pos2.y + ty - serie.label.lineWidth); var currSin1 = Mathf.Sin((360 - currAngle) * Mathf.Deg2Rad); var currCos1 = Mathf.Cos((360 - currAngle) * Mathf.Deg2Rad); var r4 = Mathf.Sqrt(radius1 * radius1 - Mathf.Pow(currCos1 * radius3, 2)) - currSin1 * radius3; r4 += serie.label.lineLength1 - lineCircleDiff; pos6 = pos0 + Vector3.left * lineCircleDiff; pos4 = pos6 + Vector3.left * r4; } var pos5 = new Vector3(currAngle > 180 ? pos3.x - serie.label.lineLength2 : pos3.x + serie.label.lineLength2, pos3.y); switch (serie.label.lineType) { case SerieLabel.LineType.BrokenLine: ChartDrawer.DrawLine(vh, pos1, pos2, serie.label.lineWidth, color); ChartDrawer.DrawLine(vh, pos3, pos5, serie.label.lineWidth, color); break; case SerieLabel.LineType.Curves: ChartDrawer.DrawCurves(vh, pos1, pos5, pos1, pos2, serie.label.lineWidth, color, m_Settings.lineSmoothness); break; case SerieLabel.LineType.HorizontalLine: ChartDrawer.DrawCricle(vh, pos0, horizontalLineCircleRadius, color); ChartDrawer.DrawLine(vh, pos6, pos4, serie.label.lineWidth, color); break; } } }
private void DrawBarBackground(VertexHelper vh, Serie serie, SerieData serieData, ItemStyle itemStyle, int colorIndex, bool highlight, float pX, float pY, float space, float barWidth, bool isYAxis) { Color color = SerieHelper.GetItemBackgroundColor(serie, serieData, m_ThemeInfo, colorIndex, highlight, false); if (ChartHelper.IsClearColor(color)) { return; } if (isYAxis) { var axis = m_YAxises[serie.axisIndex]; var axisWidth = axis.axisLine.width; Vector3 plt = new Vector3(m_CoordinateX + axisWidth, pY + space + barWidth); Vector3 prt = new Vector3(m_CoordinateX + axisWidth + m_CoordinateWidth, pY + space + barWidth); Vector3 prb = new Vector3(m_CoordinateX + axisWidth + m_CoordinateWidth, pY + space); Vector3 plb = new Vector3(m_CoordinateX + axisWidth, pY + space); if (serie.barType == BarType.Capsule) { var radius = barWidth / 2; var diff = Vector3.right * radius; var pcl = (plt + plb) / 2 + diff; var pcr = (prt + prb) / 2 - diff; CheckClipAndDrawPolygon(vh, plb + diff, plt + diff, prt - diff, prb - diff, color, color, serie.clip); ChartDrawer.DrawSector(vh, pcl, radius, color, 180, 360); ChartDrawer.DrawSector(vh, pcr, radius, color, 0, 180); if (itemStyle.NeedShowBorder()) { var borderWidth = itemStyle.borderWidth; var borderColor = itemStyle.borderColor; var smoothness = m_Settings.cicleSmoothness; var inRadius = radius - borderWidth; var outRadius = radius; var p1 = plb + diff + Vector3.up * borderWidth / 2; var p2 = prb - diff + Vector3.up * borderWidth / 2; var p3 = plt + diff - Vector3.up * borderWidth / 2; var p4 = prt - diff - Vector3.up * borderWidth / 2; ChartDrawer.DrawLine(vh, p1, p2, borderWidth / 2, borderColor); ChartDrawer.DrawLine(vh, p3, p4, borderWidth / 2, borderColor); ChartDrawer.DrawDoughnut(vh, pcl, inRadius, outRadius, borderColor, Color.clear, 180, 360, smoothness); ChartDrawer.DrawDoughnut(vh, pcr, inRadius, outRadius, borderColor, Color.clear, 0, 180, smoothness); } } else { CheckClipAndDrawPolygon(vh, ref plb, ref plt, ref prt, ref prb, color, color, serie.clip); } } else { var axis = m_XAxises[serie.axisIndex]; var axisWidth = axis.axisLine.width; Vector3 plb = new Vector3(pX + space, m_CoordinateY + axisWidth); Vector3 plt = new Vector3(pX + space, m_CoordinateY + m_CoordinateHeight + axisWidth); Vector3 prt = new Vector3(pX + space + barWidth, m_CoordinateY + m_CoordinateHeight + axisWidth); Vector3 prb = new Vector3(pX + space + barWidth, m_CoordinateY + axisWidth); if (serie.barType == BarType.Capsule) { var radius = barWidth / 2; var diff = Vector3.up * radius; var pct = (plt + prt) / 2 - diff; var pcb = (plb + prb) / 2 + diff; CheckClipAndDrawPolygon(vh, prb + diff, plb + diff, plt - diff, prt - diff, color, color, serie.clip); ChartDrawer.DrawSector(vh, pct, radius, color, 270, 450); ChartDrawer.DrawSector(vh, pcb, radius, color, 90, 270); if (itemStyle.NeedShowBorder()) { var borderWidth = itemStyle.borderWidth; var borderColor = itemStyle.borderColor; var smoothness = m_Settings.cicleSmoothness; var inRadius = radius - borderWidth; var outRadius = radius; var p1 = plb + diff + Vector3.right * borderWidth / 2; var p2 = plt - diff + Vector3.right * borderWidth / 2; var p3 = prb + diff - Vector3.right * borderWidth / 2; var p4 = prt - diff - Vector3.right * borderWidth / 2; ChartDrawer.DrawLine(vh, p1, p2, borderWidth / 2, borderColor); ChartDrawer.DrawLine(vh, p3, p4, borderWidth / 2, borderColor); ChartDrawer.DrawDoughnut(vh, pct, inRadius, outRadius, borderColor, Color.clear, 270, 450, smoothness); ChartDrawer.DrawDoughnut(vh, pcb, inRadius, outRadius, borderColor, Color.clear, 90, 270, smoothness); } } else { CheckClipAndDrawPolygon(vh, ref prb, ref plb, ref plt, ref prt, color, color, serie.clip); } } }
private void DrawData(VertexHelper vh) { Vector3 startPoint = Vector3.zero; Vector3 toPoint = Vector3.zero; Vector3 firstPoint = Vector3.zero; serieNameSet.Clear(); int serieNameCount = -1; for (int i = 0; i < m_Series.Count; i++) { var serie = m_Series.list[i]; var radar = m_Radars[serie.radarIndex]; int indicatorNum = radar.indicatorList.Count; var angle = 2 * Mathf.PI / indicatorNum; Vector3 p = radar.centerPos; serie.animation.InitProgress(1, 0, 1); if (!IsActive(i)) { continue; } var rate = serie.animation.GetCurrRate(); for (int j = 0; j < serie.data.Count; j++) { var serieData = serie.data[j]; int key = i * 100 + j; if (!radar.dataPosList.ContainsKey(key)) { radar.dataPosList.Add(i * 100 + j, new List <Vector3>(serieData.data.Count)); } else { radar.dataPosList[key].Clear(); } string dataName = serieData.name; int serieIndex = 0; if (string.IsNullOrEmpty(dataName)) { serieNameCount++; serieIndex = serieNameCount; } else if (!serieNameSet.ContainsKey(dataName)) { serieNameSet.Add(dataName, serieNameCount); serieNameCount++; serieIndex = serieNameCount; } else { serieIndex = serieNameSet[dataName]; } if (!serieData.show) { continue; } var isHighlight = serie.highlighted || serieData.highlighted || (m_Tooltip.show && m_Tooltip.dataIndex[0] == i && m_Tooltip.dataIndex[1] == j); var areaColor = serie.GetAreaColor(m_ThemeInfo, serieIndex, isHighlight); var lineColor = serie.GetLineColor(m_ThemeInfo, serieIndex, isHighlight); int dataCount = radar.indicatorList.Count; List <Vector3> pointList = radar.dataPosList[key]; for (int n = 0; n < dataCount; n++) { if (n >= serieData.data.Count) { break; } float min = radar.GetIndicatorMin(n); float max = radar.GetIndicatorMax(n); float value = serieData.data[n]; if (max == 0) { serie.GetMinMaxData(n, out min, out max); min = radar.GetIndicatorMin(n); } var radius = max < 0 ? radar.actualRadius - radar.actualRadius * value / max : radar.actualRadius * value / max; var currAngle = n * angle; radius *= rate; if (n == 0) { startPoint = new Vector3(p.x + radius * Mathf.Sin(currAngle), p.y + radius * Mathf.Cos(currAngle)); firstPoint = startPoint; } else { toPoint = new Vector3(p.x + radius * Mathf.Sin(currAngle), p.y + radius * Mathf.Cos(currAngle)); if (serie.areaStyle.show) { ChartDrawer.DrawTriangle(vh, p, startPoint, toPoint, areaColor); } if (serie.lineStyle.show) { ChartDrawer.DrawLine(vh, startPoint, toPoint, serie.lineStyle.width, lineColor); } startPoint = toPoint; } pointList.Add(startPoint); } if (serie.areaStyle.show) { ChartDrawer.DrawTriangle(vh, p, startPoint, firstPoint, areaColor); } if (serie.lineStyle.show) { ChartDrawer.DrawLine(vh, startPoint, firstPoint, serie.lineStyle.width, lineColor); } if (serie.symbol.type != SerieSymbolType.None) { var symbolSize = (isHighlight ? serie.symbol.selectedSize : serie.symbol.size); var symbolColor = serie.symbol.color != Color.clear ? serie.symbol.color : lineColor; symbolColor.a *= serie.symbol.opacity; foreach (var point in pointList) { DrawSymbol(vh, serie.symbol.type, symbolSize, serie.lineStyle.width, point, symbolColor); } } } if (!serie.animation.IsFinish()) { float duration = serie.animation.duration > 0 ? (float)serie.animation.duration / 1000 : 1; float speed = 1 / duration; serie.animation.CheckProgress(Time.deltaTime * speed); RefreshChart(); } } }