mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-23 09:20:08 +00:00
优化数据存储类型由float全部转为double
This commit is contained in:
@@ -249,11 +249,11 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
public string GetFormatterContent(int labelIndex, float value, float minValue, float maxValue, bool isLog = false)
|
||||
public string GetFormatterContent(int labelIndex, double value, double minValue, double maxValue, bool isLog = false)
|
||||
{
|
||||
if (showAsPositiveNumber && value < 0)
|
||||
{
|
||||
value = Mathf.Abs(value);
|
||||
value = Math.Abs(value);
|
||||
}
|
||||
if (m_FormatterFunction != null)
|
||||
{
|
||||
@@ -283,7 +283,7 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
public string GetFormatterDateTime(int labelIndex, float value)
|
||||
public string GetFormatterDateTime(int labelIndex, double value)
|
||||
{
|
||||
if (m_FormatterFunction != null)
|
||||
{
|
||||
|
||||
@@ -358,14 +358,14 @@ namespace XCharts
|
||||
else return dataIndex <= m_CurrDataProgress;
|
||||
}
|
||||
|
||||
internal void CheckProgress(float total)
|
||||
internal void CheckProgress(double total)
|
||||
{
|
||||
if (IsFinish()) return;
|
||||
if (!m_IsInit || m_IsPause || m_IsEnd) return;
|
||||
if (IsInDelay()) return;
|
||||
m_ActualDuration = (int)((Time.time - startTime) * 1000) - fadeInDelay;
|
||||
var duration = GetCurrAnimationDuration();
|
||||
var delta = total / duration * Time.deltaTime;
|
||||
var delta = (float)(total / duration * Time.deltaTime);
|
||||
if (m_FadeOut)
|
||||
{
|
||||
m_CurrDetailProgress -= delta;
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace XCharts
|
||||
[SerializeField] private Emphasis m_Emphasis = new Emphasis();
|
||||
[SerializeField] private bool m_EnableSymbol = false;
|
||||
[SerializeField] private SerieSymbol m_Symbol = new SerieSymbol();
|
||||
[SerializeField] private List<float> m_Data = new List<float>();
|
||||
[SerializeField] private List<double> m_Data = new List<double>();
|
||||
|
||||
public ChartLabel labelObject { get; set; }
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace XCharts
|
||||
/// An arbitrary dimension data list of data item.
|
||||
/// 可指定任意维数的数值列表。
|
||||
/// </summary>
|
||||
public List<float> data { get { return m_Data; } set { m_Data = value; } }
|
||||
public List<double> data { get { return m_Data; } set { m_Data = value; } }
|
||||
/// <summary>
|
||||
/// [default:true] Whether the data item is showed.
|
||||
/// 该数据项是否要显示。
|
||||
@@ -171,7 +171,7 @@ namespace XCharts
|
||||
public float runtimeAngle { get; set; }
|
||||
public Vector3 runtiemPieOffsetCenter { get; set; }
|
||||
public float runtimeStackHig { get; set; }
|
||||
private List<float> m_PreviousData = new List<float>();
|
||||
private List<double> m_PreviousData = new List<double>();
|
||||
private List<float> m_DataUpdateTime = new List<float>();
|
||||
private List<bool> m_DataUpdateFlag = new List<bool>();
|
||||
private List<Vector2> m_PolygonPoints = new List<Vector2>();
|
||||
@@ -200,7 +200,7 @@ namespace XCharts
|
||||
m_Emphasis.Reset();
|
||||
}
|
||||
|
||||
public float GetData(int index, bool inverse = false)
|
||||
public double GetData(int index, bool inverse = false)
|
||||
{
|
||||
if (index >= 0 && index < m_Data.Count)
|
||||
{
|
||||
@@ -209,7 +209,7 @@ namespace XCharts
|
||||
else return 0;
|
||||
}
|
||||
|
||||
public float GetData(int index, float min, float max)
|
||||
public double GetData(int index, double min, double max)
|
||||
{
|
||||
if (index >= 0 && index < m_Data.Count)
|
||||
{
|
||||
@@ -221,7 +221,7 @@ namespace XCharts
|
||||
else return 0;
|
||||
}
|
||||
|
||||
public float GetPreviousData(int index, bool inverse = false)
|
||||
public double GetPreviousData(int index, bool inverse = false)
|
||||
{
|
||||
if (index >= 0 && index < m_PreviousData.Count)
|
||||
{
|
||||
@@ -230,24 +230,24 @@ namespace XCharts
|
||||
else return 0;
|
||||
}
|
||||
|
||||
public float GetFirstData(float animationDuration = 500f)
|
||||
public double GetFirstData(float animationDuration = 500f)
|
||||
{
|
||||
if (m_Data.Count > 0) return GetCurrData(0, animationDuration);
|
||||
return 0;
|
||||
}
|
||||
|
||||
public float GetLastData()
|
||||
public double GetLastData()
|
||||
{
|
||||
if (m_Data.Count > 0) return m_Data[m_Data.Count - 1];
|
||||
return 0;
|
||||
}
|
||||
|
||||
public float GetCurrData(int index, float animationDuration = 500f, bool inverse = false)
|
||||
public double GetCurrData(int index, float animationDuration = 500f, bool inverse = false)
|
||||
{
|
||||
return GetCurrData(index, animationDuration, inverse, 0, 0);
|
||||
}
|
||||
|
||||
public float GetCurrData(int index, float animationDuration, bool inverse, float min, float max)
|
||||
public double GetCurrData(int index, float animationDuration, bool inverse, double min, double max)
|
||||
{
|
||||
if (index < m_DataUpdateFlag.Count && m_DataUpdateFlag[index] && animationDuration > 0)
|
||||
{
|
||||
@@ -259,7 +259,7 @@ namespace XCharts
|
||||
if (rate < 1)
|
||||
{
|
||||
CheckLastData();
|
||||
var curr = Mathf.Lerp(GetPreviousData(index), GetData(index), rate);
|
||||
var curr = MathUtil.Lerp(GetPreviousData(index), GetData(index), rate);
|
||||
if (min != 0 || max != 0)
|
||||
{
|
||||
if (inverse)
|
||||
@@ -299,10 +299,10 @@ namespace XCharts
|
||||
/// the maxinum value.
|
||||
/// 最大值。
|
||||
/// </summary>
|
||||
public float GetMaxData(bool inverse = false)
|
||||
public double GetMaxData(bool inverse = false)
|
||||
{
|
||||
if (m_Data.Count == 0) return 0;
|
||||
float temp = float.MinValue;
|
||||
var temp = double.MinValue;
|
||||
for (int i = 0; i < m_Data.Count; i++)
|
||||
{
|
||||
var value = GetData(i, inverse);
|
||||
@@ -310,15 +310,15 @@ namespace XCharts
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// the mininum value.
|
||||
/// 最小值。
|
||||
/// </summary>
|
||||
public float GetMinData(bool inverse = false)
|
||||
public double GetMinData(bool inverse = false)
|
||||
{
|
||||
if (m_Data.Count == 0) return 0;
|
||||
float temp = float.MaxValue;
|
||||
var temp = double.MaxValue;
|
||||
for (int i = 0; i < m_Data.Count; i++)
|
||||
{
|
||||
var value = GetData(i, inverse);
|
||||
@@ -327,7 +327,7 @@ namespace XCharts
|
||||
return temp;
|
||||
}
|
||||
|
||||
public bool UpdateData(int dimension, float value, bool updateAnimation, float animationDuration = 500f)
|
||||
public bool UpdateData(int dimension, double value, bool updateAnimation, float animationDuration = 500f)
|
||||
{
|
||||
if (dimension >= 0 && dimension < data.Count)
|
||||
{
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace XCharts
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public delegate float SymbolSizeCallback(List<float> data);
|
||||
public delegate float SymbolSizeCallback(List<double> data);
|
||||
|
||||
/// <summary>
|
||||
/// 系列数据项的标记的图形
|
||||
@@ -249,7 +249,7 @@ namespace XCharts
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public float GetSize(List<float> data, float themeSize)
|
||||
public float GetSize(List<double> data, float themeSize)
|
||||
{
|
||||
switch (m_SizeType)
|
||||
{
|
||||
@@ -258,7 +258,7 @@ namespace XCharts
|
||||
case SerieSymbolSizeType.FromData:
|
||||
if (data != null && dataIndex >= 0 && dataIndex < data.Count)
|
||||
{
|
||||
return data[dataIndex] * m_DataScale;
|
||||
return (float)data[dataIndex] * m_DataScale;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -276,7 +276,7 @@ namespace XCharts
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public float GetSelectedSize(List<float> data, float themeSelectedSize)
|
||||
public float GetSelectedSize(List<double> data, float themeSelectedSize)
|
||||
{
|
||||
switch (m_SizeType)
|
||||
{
|
||||
@@ -285,7 +285,7 @@ namespace XCharts
|
||||
case SerieSymbolSizeType.FromData:
|
||||
if (data != null && dataIndex >= 0 && dataIndex < data.Count)
|
||||
{
|
||||
return data[dataIndex] * m_SelectedDataScale;
|
||||
return (float)data[dataIndex] * m_SelectedDataScale;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user