mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-18 14:30:10 +00:00
增加虚线Dash、点线Dot、点划线DashDot、双点划线DashDotDot等类型的折线图支持
This commit is contained in:
@@ -958,34 +958,20 @@ namespace XCharts
|
||||
switch (type)
|
||||
{
|
||||
case Axis.SplitLineType.Dashed:
|
||||
ChartHelper.DrawDashLine(vh, startPos, endPos, axis.axisLine.width, color);
|
||||
break;
|
||||
case Axis.SplitLineType.Dotted:
|
||||
var startX = startPos.x;
|
||||
var startY = startPos.y;
|
||||
var dashLen = type == Axis.SplitLineType.Dashed ? 6 : 2.5f;
|
||||
var count = isYAxis ? (endPos.x - startPos.x) / (dashLen * 2) :
|
||||
(endPos.y - startPos.y) / (dashLen * 2);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (isYAxis)
|
||||
{
|
||||
var toX = startX + dashLen;
|
||||
ChartHelper.DrawLine(vh, new Vector3(startX, startY), new Vector3(toX, startY),
|
||||
axis.axisLine.width, color);
|
||||
startX += dashLen * 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
var toY = startY + dashLen;
|
||||
ChartHelper.DrawLine(vh, new Vector3(startX, startY), new Vector3(startX, toY),
|
||||
axis.axisLine.width, color);
|
||||
startY += dashLen * 2;
|
||||
}
|
||||
|
||||
}
|
||||
ChartHelper.DrawDotLine(vh, startPos, endPos, axis.axisLine.width, color);
|
||||
break;
|
||||
case Axis.SplitLineType.Solid:
|
||||
ChartHelper.DrawLine(vh, startPos, endPos, axis.axisLine.width, color);
|
||||
break;
|
||||
case Axis.SplitLineType.DashDot:
|
||||
ChartHelper.DrawDashDotLine(vh, startPos, endPos, axis.axisLine.width, color);
|
||||
break;
|
||||
case Axis.SplitLineType.DashDotDot:
|
||||
ChartHelper.DrawDashDotDotLine(vh, startPos, endPos, axis.axisLine.width, color);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user