修复SerieData回收时部分配置没有重置的问题

This commit is contained in:
monitor1394
2020-06-10 13:10:24 +08:00
parent 51159db106
commit e00fd46bdf
7 changed files with 94 additions and 8 deletions

View File

@@ -19,6 +19,14 @@ namespace XCharts
[SerializeField] private bool m_Show;
[SerializeField] private SerieLabel m_Label = new SerieLabel();
[SerializeField] private ItemStyle m_ItemStyle = new ItemStyle();
public void Reset()
{
m_Show = false;
m_Label.Reset();
m_ItemStyle.Reset();
}
/// <summary>
/// 是否启用高亮样式。
/// </summary>

View File

@@ -29,6 +29,16 @@ namespace XCharts
[SerializeField] private float m_Height = 40;
[SerializeField] private Vector3 m_Offset;
public void Reset()
{
m_Show = false;
m_Layer = Layer.UnderLabel;
m_Sprite = null;
m_Color = Color.white;
m_Width = 40;
m_Height = 40;
m_Offset = Vector3.zero;
}
/// <summary>
/// Whether the data icon is show.
/// 是否显示图标。
@@ -59,5 +69,7 @@ namespace XCharts
/// 图标偏移。
/// </summary>
public Vector3 offset { get { return m_Offset; } set { m_Offset = value; } }
}
}

View File

@@ -50,6 +50,27 @@ namespace XCharts
[SerializeField] private string m_NumericFormatter = "";
[SerializeField] private float[] m_CornerRadius = new float[] { 0, 0, 0, 0 };
public void Reset()
{
m_Show = false;
m_Color = Color.clear;
m_ToColor = Color.clear;
m_BackgroundColor = Color.clear;
m_BackgroundWidth = 0;
m_CenterColor = Color.clear;
m_CenterGap = 0;
m_BorderType = Type.Solid;
m_BorderWidth = 0;
m_BorderColor = Color.clear;
m_Opacity = 1;
m_TooltipFormatter = null;
m_NumericFormatter = "";
m_CornerRadius[0] = 0;
m_CornerRadius[1] = 0;
m_CornerRadius[2] = 0;
m_CornerRadius[3] = 0;
}
/// <summary>
/// 是否启用。
/// </summary>

View File

@@ -162,15 +162,22 @@ namespace XCharts
private List<float> m_DataUpdateTime = new List<float>();
private List<bool> m_DataUpdateFlag = new List<bool>();
public void Clear()
public void Reset()
{
index = 0;
labelObject = null;
m_Name = string.Empty;
m_Selected = false;
m_CanShowLabel = false;
m_Radius = 0;
m_Data.Clear();
m_PreviousData.Clear();
m_DataUpdateTime.Clear();
m_DataUpdateFlag.Clear();
m_IconStyle.Reset();
m_Label.Reset();
m_ItemStyle.Reset();
m_Emphasis.Reset();
}
public float GetData(int index, bool inverse = false)

View File

@@ -79,7 +79,7 @@ namespace XCharts
HorizontalLine
}
[SerializeField] private bool m_Show = false;
[SerializeField] Position m_Position;
[SerializeField] Position m_Position = Position.Outside;
[SerializeField] private Vector3 m_Offset;
[SerializeField] private float m_Margin;
[SerializeField] private string m_Formatter;
@@ -104,6 +104,33 @@ namespace XCharts
[SerializeField] private string m_NumericFormatter = "";
[SerializeField] private bool m_AutoOffset = false;
public void Reset()
{
m_Show = false;
m_Position = Position.Outside;
m_Offset = Vector3.zero;
m_Margin = 0;
m_PaddingLeftRight = 2f;
m_PaddingTopBottom = 2f;
m_Color = Color.clear;
m_BackgroundColor = Color.clear;
m_BackgroundWidth = 0;
m_BackgroundHeight = 0;
m_FontSize = 18;
m_FontStyle = FontStyle.Normal;
m_Line = true;
m_LineType = LineType.BrokenLine;
m_LineColor = Color.clear;
m_LineWidth = 1.0f;
m_LineLength1 = 25f;
m_LineLength2 = 15f;
m_Border = false;
m_BorderWidth = 0.5f;
m_BorderColor = Color.grey;
m_NumericFormatter = "";
m_AutoOffset = false;
}
/// <summary>
/// Whether the label is showed.
/// 是否显示文本标签。