mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-23 01:10:08 +00:00
增加MarkLine标线 (#142)
This commit is contained in:
@@ -319,6 +319,7 @@ namespace XCharts
|
||||
[SerializeField] private ItemStyle m_ItemStyle = new ItemStyle();
|
||||
[SerializeField] private Emphasis m_Emphasis = new Emphasis();
|
||||
[SerializeField] private TitleStyle m_TitleStyle = new TitleStyle();
|
||||
[SerializeField] private MarkLine m_MarkLine = MarkLine.defaultMarkLine;
|
||||
[SerializeField] [Range(1, 10)] private int m_ShowDataDimension;
|
||||
[SerializeField] private bool m_ShowDataName;
|
||||
[SerializeField] private bool m_ShowDataIcon;
|
||||
@@ -853,6 +854,14 @@ namespace XCharts
|
||||
set { if (PropertyUtil.SetClass(ref m_TitleStyle, value, true)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 标线。
|
||||
/// </summary>
|
||||
public MarkLine markLine
|
||||
{
|
||||
get { return m_MarkLine; }
|
||||
set { if (PropertyUtil.SetClass(ref m_MarkLine, value, true)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 数据项里的数据维数。
|
||||
/// </summary>
|
||||
public int showDataDimension { get { return m_ShowDataDimension; } set { m_ShowDataDimension = value; } }
|
||||
@@ -1068,7 +1077,8 @@ namespace XCharts
|
||||
label.vertsDirty ||
|
||||
emphasis.vertsDirty ||
|
||||
gaugeAxis.vertsDirty ||
|
||||
gaugePointer.vertsDirty;
|
||||
gaugePointer.vertsDirty ||
|
||||
markLine.vertsDirty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1086,6 +1096,7 @@ namespace XCharts
|
||||
gaugeAxis.ClearVerticesDirty();
|
||||
gaugePointer.ClearVerticesDirty();
|
||||
titleStyle.ClearVerticesDirty();
|
||||
markLine.ClearVerticesDirty();
|
||||
}
|
||||
|
||||
public override void ClearComponentDirty()
|
||||
@@ -1101,6 +1112,7 @@ namespace XCharts
|
||||
gaugeAxis.ClearComponentDirty();
|
||||
gaugePointer.ClearComponentDirty();
|
||||
titleStyle.ClearComponentDirty();
|
||||
markLine.ClearComponentDirty();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1911,6 +1923,75 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 启用或取消初始动画
|
||||
/// </summary>
|
||||
public void AnimationEnable(bool flag)
|
||||
{
|
||||
if (animation.enable) animation.enable = flag;
|
||||
if (markLine.show && markLine.animation.enable) markLine.animation.enable = flag;
|
||||
SetVerticesDirty();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 渐入动画
|
||||
/// </summary>
|
||||
public void AnimationFadeIn()
|
||||
{
|
||||
if (animation.enable) animation.FadeIn();
|
||||
if (markLine.show && markLine.animation.enable) markLine.animation.FadeIn();
|
||||
SetVerticesDirty();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 渐出动画
|
||||
/// </summary>
|
||||
public void AnimationFadeOut()
|
||||
{
|
||||
if (animation.enable) animation.FadeOut();
|
||||
if (markLine.show && markLine.animation.enable) markLine.animation.FadeOut();
|
||||
SetVerticesDirty();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 暂停动画
|
||||
/// </summary>
|
||||
public void AnimationPause()
|
||||
{
|
||||
if (animation.enable) animation.Pause();
|
||||
if (markLine.show && markLine.animation.enable) markLine.animation.Pause();
|
||||
SetVerticesDirty();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 继续动画
|
||||
/// </summary>
|
||||
public void AnimationResume()
|
||||
{
|
||||
if (animation.enable) animation.Resume();
|
||||
if (markLine.show && markLine.animation.enable) markLine.animation.Resume();
|
||||
SetVerticesDirty();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重置动画
|
||||
/// </summary>
|
||||
public void AnimationReset()
|
||||
{
|
||||
if (animation.enable) animation.Reset();
|
||||
if (markLine.show && markLine.animation.enable) markLine.animation.Reset();
|
||||
SetVerticesDirty();
|
||||
}
|
||||
/// <summary>
|
||||
/// 重置动画
|
||||
/// </summary>
|
||||
public void AnimationRestart()
|
||||
{
|
||||
if (animation.enable) animation.Restart();
|
||||
if (markLine.show && markLine.animation.enable) markLine.animation.Restart();
|
||||
SetVerticesDirty();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从json中导入数据
|
||||
/// </summary>
|
||||
|
||||
@@ -103,9 +103,9 @@ namespace XCharts
|
||||
/// </summary>
|
||||
public void ClearData()
|
||||
{
|
||||
AnimationFadeIn();
|
||||
foreach (var serie in m_Series)
|
||||
{
|
||||
serie.AnimationFadeIn();
|
||||
serie.ClearData();
|
||||
}
|
||||
}
|
||||
@@ -259,7 +259,7 @@ namespace XCharts
|
||||
/// </summary>
|
||||
public void RemoveAll()
|
||||
{
|
||||
AnimationFadeIn();
|
||||
foreach(var serie in m_Series) serie.AnimationFadeIn();
|
||||
m_Series.Clear();
|
||||
}
|
||||
|
||||
@@ -302,7 +302,7 @@ namespace XCharts
|
||||
{
|
||||
serie.symbol.show = false;
|
||||
}
|
||||
serie.animation.Restart();
|
||||
serie.AnimationRestart();
|
||||
if (addToHead) m_Series.Insert(0, serie);
|
||||
else if (index >= 0) m_Series.Insert(index, serie);
|
||||
else m_Series.Add(serie);
|
||||
@@ -662,8 +662,8 @@ namespace XCharts
|
||||
if (serie != null)
|
||||
{
|
||||
serie.show = active;
|
||||
serie.animation.Reset();
|
||||
if (active) serie.animation.FadeIn();
|
||||
serie.AnimationReset();
|
||||
if (active) serie.AnimationFadeIn();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -692,74 +692,5 @@ namespace XCharts
|
||||
serie.symbol.selectedSizeCallback = selectedSize;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 启用或取消初始动画
|
||||
/// </summary>
|
||||
public void AnimationEnable(bool flag)
|
||||
{
|
||||
foreach (var serie in m_Series)
|
||||
{
|
||||
serie.animation.enable = flag;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 渐入动画
|
||||
/// </summary>
|
||||
public void AnimationFadeIn()
|
||||
{
|
||||
foreach (var serie in m_Series)
|
||||
{
|
||||
if (serie.animation.enable)
|
||||
{
|
||||
serie.animation.FadeIn();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 渐出动画
|
||||
/// </summary>
|
||||
public void AnimationFadeOut()
|
||||
{
|
||||
foreach (var serie in m_Series)
|
||||
{
|
||||
if (serie.animation.enable) serie.animation.FadeOut();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 暂停动画
|
||||
/// </summary>
|
||||
public void AnimationPause()
|
||||
{
|
||||
foreach (var serie in m_Series)
|
||||
{
|
||||
if (serie.animation.enable) serie.animation.Pause();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 继续动画
|
||||
/// </summary>
|
||||
public void AnimationResume()
|
||||
{
|
||||
foreach (var serie in m_Series)
|
||||
{
|
||||
if (serie.animation.enable) serie.animation.Resume();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重置动画
|
||||
/// </summary>
|
||||
public void AnimationReset()
|
||||
{
|
||||
foreach (var serie in m_Series)
|
||||
{
|
||||
if (serie.animation.enable) serie.animation.Reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,6 +90,7 @@ namespace XCharts
|
||||
public float runtimeY { get; private set; }
|
||||
public float runtimeWidth { get; private set; }
|
||||
public float runtimeHeight { get; private set; }
|
||||
public Vector3 runtimePosition { get; private set; }
|
||||
|
||||
internal void UpdateRuntimeData(float chartX, float chartY, float chartWidth, float chartHeight)
|
||||
{
|
||||
@@ -101,6 +102,7 @@ namespace XCharts
|
||||
runtimeY = chartY + runtimeBottom;
|
||||
runtimeWidth = chartWidth - runtimeLeft - runtimeRight;
|
||||
runtimeHeight = chartHeight - runtimeTop - runtimeBottom;
|
||||
runtimePosition = new Vector3(runtimeX, runtimeY);
|
||||
}
|
||||
|
||||
public static Grid defaultGrid
|
||||
|
||||
Reference in New Issue
Block a user