mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-19 06:50:18 +00:00
增加AxisLine的startExtendLength和endExtendLength设置轴线的延长线
This commit is contained in:
@@ -80,6 +80,7 @@ slug: /changelog
|
||||
|
||||
## master
|
||||
|
||||
* (2025.09.01) 增加`AxisLine`的`startExtendLength`和`endExtendLength`设置轴线的延长线
|
||||
* (2025.08.27) 修复`Serie`的`TitleStyle`在数据变更时不及时刷新的问题
|
||||
* (2025.05.19) 修复`TMP`开启时`Axis`运行报错
|
||||
* (2025.04.25) 修复`MarkArea`指定`yValue`或`xValue`时绘制区域不准确的问题
|
||||
|
||||
@@ -29,6 +29,8 @@ namespace XCharts.Editor
|
||||
{
|
||||
base.DrawExtendeds(prop);
|
||||
PropertyField(prop, "m_OnZero");
|
||||
PropertyField(prop, "m_StartExtendLength");
|
||||
PropertyField(prop, "m_EndExtendLength");
|
||||
PropertyField(prop, "m_ShowArrow");
|
||||
PropertyField(prop, "m_Arrow");
|
||||
}
|
||||
|
||||
@@ -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