mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-26 19:00:24 +00:00
修复SerieData回收时部分配置没有重置的问题
This commit is contained in:
@@ -15,7 +15,6 @@ namespace XCharts.Examples
|
|||||||
public class Example31_PieUpdateName : MonoBehaviour
|
public class Example31_PieUpdateName : MonoBehaviour
|
||||||
{
|
{
|
||||||
PieChart chart;
|
PieChart chart;
|
||||||
int count = 0;
|
|
||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
@@ -35,9 +34,9 @@ namespace XCharts.Examples
|
|||||||
{
|
{
|
||||||
if (Input.GetKeyDown(KeyCode.Space))
|
if (Input.GetKeyDown(KeyCode.Space))
|
||||||
{
|
{
|
||||||
if (count % 2 == 0) ResetSameName();
|
ClearAndAddData();
|
||||||
else UpdateDataName();
|
//UpdateDataName();
|
||||||
count++;
|
//UpdateDataName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +62,19 @@ namespace XCharts.Examples
|
|||||||
{
|
{
|
||||||
chart.UpdateDataName(serieIndex, i, "piename");
|
chart.UpdateDataName(serieIndex, i, "piename");
|
||||||
}
|
}
|
||||||
chart.themeInfo.SetAllDirty();
|
}
|
||||||
|
|
||||||
|
void ClearAndAddData()
|
||||||
|
{
|
||||||
|
var serieIndex = 0;
|
||||||
|
var serie = chart.series.GetSerie(serieIndex);
|
||||||
|
if (serie == null) return;
|
||||||
|
int count = serie.dataCount;
|
||||||
|
serie.ClearData();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
chart.AddData(0, Random.Range(0, 100), "pie" + i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -19,6 +19,14 @@ namespace XCharts
|
|||||||
[SerializeField] private bool m_Show;
|
[SerializeField] private bool m_Show;
|
||||||
[SerializeField] private SerieLabel m_Label = new SerieLabel();
|
[SerializeField] private SerieLabel m_Label = new SerieLabel();
|
||||||
[SerializeField] private ItemStyle m_ItemStyle = new ItemStyle();
|
[SerializeField] private ItemStyle m_ItemStyle = new ItemStyle();
|
||||||
|
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
m_Show = false;
|
||||||
|
m_Label.Reset();
|
||||||
|
m_ItemStyle.Reset();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否启用高亮样式。
|
/// 是否启用高亮样式。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -29,6 +29,16 @@ namespace XCharts
|
|||||||
[SerializeField] private float m_Height = 40;
|
[SerializeField] private float m_Height = 40;
|
||||||
[SerializeField] private Vector3 m_Offset;
|
[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>
|
/// <summary>
|
||||||
/// Whether the data icon is show.
|
/// Whether the data icon is show.
|
||||||
/// 是否显示图标。
|
/// 是否显示图标。
|
||||||
@@ -59,5 +69,7 @@ namespace XCharts
|
|||||||
/// 图标偏移。
|
/// 图标偏移。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Vector3 offset { get { return m_Offset; } set { m_Offset = value; } }
|
public Vector3 offset { get { return m_Offset; } set { m_Offset = value; } }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,27 @@ namespace XCharts
|
|||||||
[SerializeField] private string m_NumericFormatter = "";
|
[SerializeField] private string m_NumericFormatter = "";
|
||||||
[SerializeField] private float[] m_CornerRadius = new float[] { 0, 0, 0, 0 };
|
[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>
|
||||||
/// 是否启用。
|
/// 是否启用。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -162,15 +162,22 @@ namespace XCharts
|
|||||||
private List<float> m_DataUpdateTime = new List<float>();
|
private List<float> m_DataUpdateTime = new List<float>();
|
||||||
private List<bool> m_DataUpdateFlag = new List<bool>();
|
private List<bool> m_DataUpdateFlag = new List<bool>();
|
||||||
|
|
||||||
public void Clear()
|
public void Reset()
|
||||||
{
|
{
|
||||||
|
index = 0;
|
||||||
|
labelObject = null;
|
||||||
m_Name = string.Empty;
|
m_Name = string.Empty;
|
||||||
m_Selected = false;
|
m_Selected = false;
|
||||||
|
m_CanShowLabel = false;
|
||||||
m_Radius = 0;
|
m_Radius = 0;
|
||||||
m_Data.Clear();
|
m_Data.Clear();
|
||||||
m_PreviousData.Clear();
|
m_PreviousData.Clear();
|
||||||
m_DataUpdateTime.Clear();
|
m_DataUpdateTime.Clear();
|
||||||
m_DataUpdateFlag.Clear();
|
m_DataUpdateFlag.Clear();
|
||||||
|
m_IconStyle.Reset();
|
||||||
|
m_Label.Reset();
|
||||||
|
m_ItemStyle.Reset();
|
||||||
|
m_Emphasis.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetData(int index, bool inverse = false)
|
public float GetData(int index, bool inverse = false)
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ namespace XCharts
|
|||||||
HorizontalLine
|
HorizontalLine
|
||||||
}
|
}
|
||||||
[SerializeField] private bool m_Show = false;
|
[SerializeField] private bool m_Show = false;
|
||||||
[SerializeField] Position m_Position;
|
[SerializeField] Position m_Position = Position.Outside;
|
||||||
[SerializeField] private Vector3 m_Offset;
|
[SerializeField] private Vector3 m_Offset;
|
||||||
[SerializeField] private float m_Margin;
|
[SerializeField] private float m_Margin;
|
||||||
[SerializeField] private string m_Formatter;
|
[SerializeField] private string m_Formatter;
|
||||||
@@ -104,6 +104,33 @@ namespace XCharts
|
|||||||
[SerializeField] private string m_NumericFormatter = "";
|
[SerializeField] private string m_NumericFormatter = "";
|
||||||
[SerializeField] private bool m_AutoOffset = false;
|
[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>
|
/// <summary>
|
||||||
/// Whether the label is showed.
|
/// Whether the label is showed.
|
||||||
/// 是否显示文本标签。
|
/// 是否显示文本标签。
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace XCharts
|
|||||||
|
|
||||||
static void OnClear(SerieData serieData)
|
static void OnClear(SerieData serieData)
|
||||||
{
|
{
|
||||||
serieData.Clear();
|
serieData.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SerieData Get()
|
public static SerieData Get()
|
||||||
|
|||||||
Reference in New Issue
Block a user