mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-21 16:00:24 +00:00
增加AxisLine的startExtendLength和endExtendLength设置轴线的延长线
This commit is contained in:
@@ -832,17 +832,19 @@ namespace XCharts
|
||||
var lineWidth = axis.axisLine.GetWidth(theme.lineWidth);
|
||||
var lineType = axis.axisLine.GetType(theme.lineType);
|
||||
var lineColor = axis.axisLine.GetColor(theme.lineColor);
|
||||
var sExtendLength = axis.axisLine.startExtendLength;
|
||||
var eExtendLength = axis.axisLine.endExtendLength;
|
||||
|
||||
if (orient == Orient.Horizonal)
|
||||
{
|
||||
var left = new Vector3(startX - lineWidth - (inverse ? offset : 0), startY);
|
||||
var right = new Vector3(startX + axisLength + lineWidth + (!inverse ? offset : 0), startY);
|
||||
var left = new Vector3(startX - lineWidth - (inverse ? offset : 0) - sExtendLength, startY);
|
||||
var right = new Vector3(startX + axisLength + lineWidth + (!inverse ? offset : 0) + eExtendLength, startY);
|
||||
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, left, right, lineColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
var bottom = new Vector3(startX, startY - lineWidth - (inverse ? offset : 0));
|
||||
var top = new Vector3(startX, startY + axisLength + lineWidth + (!inverse ? offset : 0));
|
||||
var bottom = new Vector3(startX, startY - lineWidth - (inverse ? offset : 0) - sExtendLength);
|
||||
var top = new Vector3(startX, startY + axisLength + lineWidth + (!inverse ? offset : 0) + eExtendLength);
|
||||
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, bottom, top, lineColor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ namespace XCharts.Runtime
|
||||
public class AxisLine : BaseLine
|
||||
{
|
||||
[SerializeField] private bool m_OnZero;
|
||||
[SerializeField] private float m_StartExtendLength;
|
||||
[SerializeField] private float m_EndExtendLength;
|
||||
[SerializeField] private bool m_ShowArrow;
|
||||
[SerializeField] private ArrowStyle m_Arrow = new ArrowStyle();
|
||||
|
||||
@@ -23,6 +25,24 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_OnZero, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Extend length of the axis line at the start.
|
||||
/// ||轴线起点延长线长度。
|
||||
/// </summary>
|
||||
public float startExtendLength
|
||||
{
|
||||
get { return m_StartExtendLength; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_StartExtendLength, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Extend length of the axis line at the end.
|
||||
/// ||轴线终点延长线长度。
|
||||
/// </summary>
|
||||
public float endExtendLength
|
||||
{
|
||||
get { return m_EndExtendLength; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_EndExtendLength, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether to show the arrow symbol of axis.
|
||||
/// ||是否显示箭头。
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user