mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-30 05:08:48 +00:00
增加DataZoom的startLock和endLock参数支持锁定
This commit is contained in:
@@ -29,6 +29,8 @@ namespace XCharts.Editor
|
||||
PropertyField("m_RangeMode");
|
||||
PropertyField(m_Start);
|
||||
PropertyField(m_End);
|
||||
PropertyField("m_StartLock");
|
||||
PropertyField("m_EndLock");
|
||||
PropertyField(m_MinShowNum);
|
||||
if (m_Start.floatValue < 0) m_Start.floatValue = 0;
|
||||
if (m_End.floatValue > 100) m_End.floatValue = 100;
|
||||
|
||||
@@ -268,6 +268,60 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsBottom()
|
||||
{
|
||||
switch (m_Align)
|
||||
{
|
||||
case Align.BottomCenter:
|
||||
case Align.BottomLeft:
|
||||
case Align.BottomRight:
|
||||
#if dUI_TextMeshPro
|
||||
case TextAlignmentOptions.Bottom:
|
||||
case TextAlignmentOptions.BottomLeft:
|
||||
case TextAlignmentOptions.BottomRight:
|
||||
#endif
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsTop()
|
||||
{
|
||||
switch (m_Align)
|
||||
{
|
||||
case Align.TopCenter:
|
||||
case Align.TopLeft:
|
||||
case Align.TopRight:
|
||||
#if dUI_TextMeshPro
|
||||
case TextAlignmentOptions.Top:
|
||||
case TextAlignmentOptions.TopLeft:
|
||||
case TextAlignmentOptions.TopRight:
|
||||
#endif
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsCenter()
|
||||
{
|
||||
switch (m_Align)
|
||||
{
|
||||
case Align.Center:
|
||||
case Align.CenterLeft:
|
||||
case Align.CenterRight:
|
||||
#if dUI_TextMeshPro
|
||||
case TextAlignmentOptions.Center:
|
||||
case TextAlignmentOptions.CenterLeft:
|
||||
case TextAlignmentOptions.CenterRight:
|
||||
#endif
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateRuntimeData(float chartWidth, float chartHeight)
|
||||
{
|
||||
runtimeLeft = left <= 1 ? left * chartWidth : left;
|
||||
|
||||
@@ -81,8 +81,6 @@ namespace XCharts.Runtime
|
||||
[SerializeField] private RangeMode m_RangeMode;
|
||||
[SerializeField] private float m_Start;
|
||||
[SerializeField] private float m_End;
|
||||
//[SerializeField] private float m_StartValue;
|
||||
//[SerializeField] private float m_EndValue;
|
||||
[SerializeField] private int m_MinShowNum = 1;
|
||||
[Range(1f, 20f)]
|
||||
[SerializeField] private float m_ScrollSensitivity = 1.1f;
|
||||
@@ -91,6 +89,8 @@ namespace XCharts.Runtime
|
||||
[SerializeField] private LineStyle m_LineStyle = new LineStyle(LineStyle.Type.Solid);
|
||||
[SerializeField] private AreaStyle m_AreaStyle = new AreaStyle();
|
||||
[SerializeField][Since("v3.5.0")] private MarqueeStyle m_MarqueeStyle = new MarqueeStyle();
|
||||
[SerializeField][Since("v3.6.0")] private bool m_StartLock;
|
||||
[SerializeField][Since("v3.6.0")] private bool m_EndLock;
|
||||
|
||||
public DataZoomContext context = new DataZoomContext();
|
||||
|
||||
@@ -305,6 +305,24 @@ namespace XCharts.Runtime
|
||||
set { m_Start = value; if (m_Start < 0) m_Start = 0; if (m_Start > 100) m_Start = 100; SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Lock start value.
|
||||
/// |固定起始值,不让改变。
|
||||
/// </summary>
|
||||
public bool startLock
|
||||
{
|
||||
get { return m_StartLock; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_StartLock, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Lock end value.
|
||||
/// |固定结束值,不让改变。
|
||||
/// </summary>
|
||||
public bool endLock
|
||||
{
|
||||
get { return m_EndLock; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_EndLock, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// The end percentage of the window out of the data extent, in the range of 0 ~ 100.
|
||||
/// |数据窗口范围的结束百分比。范围是:0 ~ 100。
|
||||
/// </summary>
|
||||
|
||||
@@ -398,7 +398,9 @@ namespace XCharts.Runtime
|
||||
if (end < start)
|
||||
end = start;
|
||||
|
||||
if (!dataZoom.startLock)
|
||||
dataZoom.start = start;
|
||||
if (!dataZoom.endLock)
|
||||
dataZoom.end = end;
|
||||
if (dataZoom.realtime)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user