[feature][serie] support EmphasisStle,BlurStyle and SelectStyle

This commit is contained in:
monitor1394
2022-07-25 07:46:03 +08:00
parent 8dde322c04
commit 4f93628667
61 changed files with 1052 additions and 758 deletions

View File

@@ -0,0 +1,13 @@
using UnityEngine;
namespace XCharts.Runtime
{
/// <summary>
/// Configurations of blur state.
/// |淡出状态样式。
/// </summary>
[System.Serializable]
[Since("v3.2.0")]
public class BlurStyle : StateStyle, ISerieExtraComponent, ISerieDataComponent
{ }
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4e3f901db80454f89800a84977289535
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,90 @@
using UnityEngine;
namespace XCharts.Runtime
{
/// <summary>
/// Configurations of emphasis state.
/// |高亮状态样式。
/// </summary>
[System.Serializable]
[Since("v3.2.0")]
public class EmphasisStyle : StateStyle, ISerieExtraComponent, ISerieDataComponent
{
/// <summary>
/// focus type.
/// |聚焦类型。
/// </summary>
public enum FocusType
{
/// <summary>
/// Do not fade out other data, it's by default.
/// |不淡出其它图形,默认使用该配置。
/// </summary>
None,
/// <summary>
/// Only focus (not fade out) the element of the currently highlighted data.
/// |只聚焦(不淡出)当前高亮的数据的图形。
/// </summary>
Self,
/// <summary>
/// Focus on all elements of the series which the currently highlighted data belongs to.
/// |聚焦当前高亮的数据所在的系列的所有图形。
/// </summary>
Series
}
/// <summary>
/// blur scope.
/// |淡出范围。
/// </summary>
public enum BlurScope
{
/// <summary>
/// coordinate system.
/// |淡出范围为坐标系,默认使用该配置。
/// </summary>
GridCoord,
/// <summary>
/// series.
/// |淡出范围为系列。
/// </summary>
Series,
/// <summary>
/// global.
/// |淡出范围为全局。
/// </summary>
Global
}
[SerializeField] private float m_Scale = 1.1f;
[SerializeField] private FocusType m_Focus = FocusType.None;
[SerializeField] private BlurScope m_BlurScope = BlurScope.GridCoord;
/// <summary>
/// Whether to scale to highlight the data in emphasis state.
/// |高亮时的缩放倍数。
/// </summary>
public float scale
{
get { return m_Scale; }
set { if (PropertyUtil.SetStruct(ref m_Scale, value)) SetVerticesDirty(); }
}
/// <summary>
/// When the data is highlighted, whether to fade out of other data to focus the highlighted.
/// |在高亮图形时,是否淡出其它数据的图形已达到聚焦的效果。
/// </summary>
public FocusType focus
{
get { return m_Focus; }
set { if (PropertyUtil.SetStruct(ref m_Focus, value)) SetVerticesDirty(); }
}
/// <summary>
/// The range of fade out when focus is enabled.
/// |在开启focus的时候可以通过blurScope配置淡出的范围。
/// </summary>
public BlurScope blurScope
{
get { return m_BlurScope; }
set { if (PropertyUtil.SetStruct(ref m_BlurScope, value)) SetVerticesDirty(); }
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 91a31f424478042418811c32bb8aa2d5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,13 @@
using UnityEngine;
namespace XCharts.Runtime
{
/// <summary>
/// Configurations of select state.
/// |选中状态样式。
/// </summary>
[System.Serializable]
[Since("v3.2.0")]
public class SelectStyle : StateStyle, ISerieExtraComponent, ISerieDataComponent
{ }
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 986a9b6da6fdd48c49a9b665450dd605
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,113 @@
using UnityEngine;
namespace XCharts.Runtime
{
/// <summary>
/// the state style of serie.
/// |Serie的状态样式。Serie的状态有正常高亮淡出选中四种状态。
/// </summary>
[System.Serializable]
[Since("v3.2.0")]
public class StateStyle : ChildComponent
{
[SerializeField] private bool m_Show = true;
[SerializeField] private LabelStyle m_Label = new LabelStyle();
[SerializeField] private LabelLine m_LabelLine = new LabelLine();
[SerializeField] private ItemStyle m_ItemStyle = new ItemStyle();
[SerializeField] private LineStyle m_LineStyle = new LineStyle();
[SerializeField] private AreaStyle m_AreaStyle = new AreaStyle();
public void Reset()
{
m_Show = false;
m_Label.Reset();
m_LabelLine.Reset();
m_ItemStyle.Reset();
}
/// <summary>
/// 是否启用高亮样式。
/// </summary>
public bool show
{
get { return m_Show; }
set { m_Show = value; }
}
/// <summary>
/// 图形文本标签。
/// </summary>
public LabelStyle label
{
get { return m_Label; }
set { if (PropertyUtil.SetClass(ref m_Label, value, true)) SetAllDirty(); }
}
/// <summary>
/// 图形文本引导线样式。
/// </summary>
public LabelLine labelLine
{
get { return m_LabelLine; }
set { if (PropertyUtil.SetClass(ref m_LabelLine, value, true)) SetAllDirty(); }
}
/// <summary>
/// 图形样式。
/// </summary>
public ItemStyle itemStyle
{
get { return m_ItemStyle; }
set { if (PropertyUtil.SetClass(ref m_ItemStyle, value, true)) SetVerticesDirty(); }
}
/// <summary>
/// 折线样式。
/// </summary>
public LineStyle lineStyle
{
get { return m_LineStyle; }
set { if (PropertyUtil.SetClass(ref m_LineStyle, value, true)) SetVerticesDirty(); }
}
/// <summary>
/// 区域样式。
/// </summary>
public AreaStyle areaStyle
{
get { return m_AreaStyle; }
set { if (PropertyUtil.SetClass(ref m_AreaStyle, value, true)) SetVerticesDirty(); }
}
public override bool vertsDirty
{
get
{
return m_VertsDirty ||
m_Label.vertsDirty ||
m_ItemStyle.vertsDirty ||
m_LineStyle.vertsDirty ||
m_AreaStyle.vertsDirty;
}
}
public override bool componentDirty
{
get
{
return m_ComponentDirty ||
m_Label.componentDirty;
}
}
public override void ClearVerticesDirty()
{
base.ClearVerticesDirty();
m_Label.ClearVerticesDirty();
m_ItemStyle.ClearVerticesDirty();
m_LineStyle.ClearVerticesDirty();
m_AreaStyle.ClearVerticesDirty();
}
public override void ClearComponentDirty()
{
base.ClearComponentDirty();
m_Label.ClearComponentDirty();
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 921539f841914493a90f748c6c6662dc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: