[feature][polar] support multiple bar and stack bar in polar

This commit is contained in:
monitor1394
2022-09-19 13:20:34 +08:00
parent ba9faa8bc6
commit 4e05759c3c
8 changed files with 98 additions and 32 deletions

View File

@@ -116,11 +116,12 @@ namespace XCharts.Runtime
for (int i = 1; i < size; i++)
{
var scaleWidth = AxisHelper.GetScaleWidth(angleAxis, total, i);
var pos = ChartHelper.GetPos(cenPos, radius, currAngle, true);
var pos1 = ChartHelper.GetPos(cenPos, polar.context.insideRadius, currAngle, true);
var pos2 = ChartHelper.GetPos(cenPos, polar.context.outsideRadius, currAngle, true);
if (angleAxis.show && angleAxis.splitLine.show)
{
var lineWidth = angleAxis.splitLine.GetWidth(chart.theme.axis.splitLineWidth);
UGL.DrawLine(vh, cenPos, pos, lineWidth, splitLineColor);
UGL.DrawLine(vh, pos1, pos2, lineWidth, splitLineColor);
}
if (angleAxis.show && angleAxis.axisTick.show)
{
@@ -130,7 +131,7 @@ namespace XCharts.Runtime
{
var tickY = radius + tickLength;
var tickPos = ChartHelper.GetPos(cenPos, tickY, currAngle, true);
UGL.DrawLine(vh, pos, tickPos, tickWidth, tickColor);
UGL.DrawLine(vh, pos2, tickPos, tickWidth, tickColor);
}
}
currAngle += scaleWidth;

View File

@@ -135,6 +135,10 @@ namespace XCharts.Runtime
var tickLength = axis.axisTick.GetLength(chart.theme.axis.tickLength);
var tickVector = ChartHelper.GetVertialDire(dire) *
(tickLength + axis.axisLabel.distance);
if (axis.IsCategory())
{
totalWidth += polar.context.radius / axis.data.Count / 2;
}
return ChartHelper.GetPos(cenPos, totalWidth, startAngle, true) + tickVector;
}

View File

@@ -647,10 +647,10 @@ namespace XCharts.Runtime
var lineWidth = tooltip.lineStyle.GetWidth(theme.tooltip.lineWidth);
var cenPos = m_Polar.context.center;
var radius = m_Polar.context.outsideRadius;
var sp = m_Polar.context.center;
var tooltipAngle = m_AngleAxis.GetValueAngle(tooltip.context.angle);
var ep = ChartHelper.GetPos(sp, radius, tooltipAngle, true);
var sp = ChartHelper.GetPos(m_Polar.context.center, m_Polar.context.insideRadius, tooltipAngle, true);
var ep = ChartHelper.GetPos(m_Polar.context.center, m_Polar.context.outsideRadius, tooltipAngle, true);
switch (tooltip.type)
{