private Vector3 GetLabelPosition(PolarCoord polar, Axis axis, float startAngle, float totalWidth) { var cenPos = polar.context.center; var dire = ChartHelper.GetDire(startAngle, true).normalized; var tickLength = axis.axisTick.GetLength(chart.theme.axis.tickLength); var tickVector = ChartHelper.GetVertialDire(dire) * (tickLength + axis.axisLabel.distance); return(ChartHelper.GetPos(cenPos, totalWidth, startAngle, true) + tickVector); }
private void DrawRadiusAxis(VertexHelper vh, RadiusAxis radiusAxis) { var polar = chart.GetChartComponent <PolarCoord>(radiusAxis.polarIndex); if (polar == null) { return; } var angleAxis = ComponentHelper.GetAngleAxis(chart.components, polar.index); if (angleAxis == null) { return; } var startAngle = angleAxis.context.startAngle; var radius = polar.context.radius; var cenPos = polar.context.center; var size = AxisHelper.GetScaleNumber(radiusAxis, radius, null); var totalWidth = 0f; var dire = ChartHelper.GetDire(startAngle, true).normalized; var tickWidth = radiusAxis.axisTick.GetWidth(chart.theme.axis.tickWidth); var tickLength = radiusAxis.axisTick.GetLength(chart.theme.axis.tickLength); var tickVetor = ChartHelper.GetVertialDire(dire) * tickLength; for (int i = 0; i <= size; i++) { var scaleWidth = AxisHelper.GetScaleWidth(radiusAxis, radius, i); var pos = ChartHelper.GetPos(cenPos, totalWidth + tickWidth, startAngle, true); if (radiusAxis.show && radiusAxis.splitLine.show) { var outsideRaidus = totalWidth + radiusAxis.splitLine.GetWidth(chart.theme.axis.splitLineWidth) * 2; var splitLineColor = radiusAxis.splitLine.GetColor(chart.theme.axis.splitLineColor); UGL.DrawDoughnut(vh, cenPos, totalWidth, outsideRaidus, splitLineColor, Color.clear); } if (radiusAxis.show && radiusAxis.axisTick.show) { if ((i == 0 && radiusAxis.axisTick.showStartTick) || (i == size && radiusAxis.axisTick.showEndTick) || (i > 0 && i < size)) { UGL.DrawLine(vh, pos, pos + tickVetor, tickWidth, chart.theme.axis.lineColor); } } totalWidth += scaleWidth; } if (radiusAxis.show && radiusAxis.axisLine.show) { var lineStartPos = polar.context.center - dire * tickWidth; var lineEndPos = polar.context.center + dire * (radius + tickWidth); var lineWidth = radiusAxis.axisLine.GetWidth(chart.theme.axis.lineWidth); UGL.DrawLine(vh, lineStartPos, lineEndPos, lineWidth, chart.theme.axis.lineColor); } }