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:
@@ -397,7 +397,7 @@ namespace XCharts
|
||||
/// the current minimun value.
|
||||
/// 当前最小值。
|
||||
/// </summary>
|
||||
public float runtimeMinValue
|
||||
public double runtimeMinValue
|
||||
{
|
||||
get { return m_RuntimeMinValue; }
|
||||
internal set
|
||||
@@ -412,7 +412,7 @@ namespace XCharts
|
||||
/// the current maximum value.
|
||||
/// 当前最大值。
|
||||
/// </summary>
|
||||
public float runtimeMaxValue
|
||||
public double runtimeMaxValue
|
||||
{
|
||||
get { return m_RuntimeMaxValue; }
|
||||
internal set
|
||||
@@ -433,8 +433,8 @@ namespace XCharts
|
||||
/// 坐标轴原点在Y轴的偏移。
|
||||
/// </summary>
|
||||
public float runtimeZeroYOffset { get; internal set; }
|
||||
public int runtimeMinLogIndex { get { return logBaseE ? (int)Mathf.Log(runtimeMinValue) : (int)Mathf.Log(runtimeMinValue, logBase); } }
|
||||
public int runtimeMaxLogIndex { get { return logBaseE ? (int)Mathf.Log(runtimeMaxValue) : (int)Mathf.Log(runtimeMaxValue, logBase); } }
|
||||
public int runtimeMinLogIndex { get { return logBaseE ? (int)Math.Log(runtimeMinValue) : (int)Math.Log(runtimeMinValue, logBase); } }
|
||||
public int runtimeMaxLogIndex { get { return logBaseE ? (int)Math.Log(runtimeMaxValue) : (int)Math.Log(runtimeMaxValue, logBase); } }
|
||||
public bool runtimeLastCheckInverse { get; set; }
|
||||
public double runtimeMinMaxRange { get { return m_MinMaxValueRange; } set { m_MinMaxValueRange = value; } }
|
||||
public List<string> runtimeData { get { return m_RuntimeData; } }
|
||||
@@ -447,12 +447,12 @@ namespace XCharts
|
||||
private GameObject m_TooltipLabel;
|
||||
private ChartText m_TooltipLabelText;
|
||||
private RectTransform m_TooltipLabelRect;
|
||||
private float m_RuntimeMinValue;
|
||||
private float m_RuntimeLastMinValue;
|
||||
private double m_RuntimeMinValue;
|
||||
private double m_RuntimeLastMinValue;
|
||||
private bool m_RuntimeMinValueChanged;
|
||||
private float m_RuntimeMinValueUpdateTime;
|
||||
private float m_RuntimeMaxValue;
|
||||
private float m_RuntimeLastMaxValue;
|
||||
private double m_RuntimeMaxValue;
|
||||
private double m_RuntimeLastMaxValue;
|
||||
private bool m_RuntimeMaxValueChanged;
|
||||
private float m_RuntimeMaxValueUpdateTime;
|
||||
private bool m_RuntimeMinValueFirstChanged = true;
|
||||
@@ -809,7 +809,7 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
internal void UpdateMinValue(float value, bool check)
|
||||
internal void UpdateMinValue(double value, bool check)
|
||||
{
|
||||
if (value != m_RuntimeMaxValue)
|
||||
{
|
||||
@@ -837,7 +837,7 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
internal void UpdateMaxValue(float value, bool check)
|
||||
internal void UpdateMaxValue(double value, bool check)
|
||||
{
|
||||
if (value != m_RuntimeMaxValue)
|
||||
{
|
||||
@@ -865,7 +865,7 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
public float GetCurrMinValue(float duration)
|
||||
public double GetCurrMinValue(float duration)
|
||||
{
|
||||
if (!Application.isPlaying) return m_RuntimeMinValue;
|
||||
if (m_RuntimeMinValue == 0 && m_RuntimeMaxValue == 0) return 0;
|
||||
@@ -875,7 +875,7 @@ namespace XCharts
|
||||
var total = duration / 1000;
|
||||
if (duration > 0 && time <= total)
|
||||
{
|
||||
var curr = Mathf.Lerp(m_RuntimeLastMinValue, m_RuntimeMinValue, time / total);
|
||||
var curr = MathUtil.Lerp(m_RuntimeLastMinValue, m_RuntimeMinValue, time / total);
|
||||
return curr;
|
||||
}
|
||||
else
|
||||
@@ -885,7 +885,7 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
public float GetCurrMaxValue(float duration)
|
||||
public double GetCurrMaxValue(float duration)
|
||||
{
|
||||
if (!Application.isPlaying) return m_RuntimeMaxValue;
|
||||
if (m_RuntimeMinValue == 0 && m_RuntimeMaxValue == 0) return 0;
|
||||
@@ -895,7 +895,7 @@ namespace XCharts
|
||||
var total = duration / 1000;
|
||||
if (duration > 0 && time < total)
|
||||
{
|
||||
var curr = Mathf.Lerp(m_RuntimeLastMaxValue, m_RuntimeMaxValue, time / total);
|
||||
var curr = MathUtil.Lerp(m_RuntimeLastMaxValue, m_RuntimeMaxValue, time / total);
|
||||
return curr;
|
||||
}
|
||||
else
|
||||
@@ -918,10 +918,10 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
public float GetLogValue(float value)
|
||||
public float GetLogValue(double value)
|
||||
{
|
||||
if (value <= 0 || value == 1) return 0;
|
||||
return logBaseE ? Mathf.Log(value) : Mathf.Log(value, logBase);
|
||||
return logBaseE ? (float)Math.Log(value) : (float)Math.Log(value, logBase);
|
||||
}
|
||||
|
||||
public bool IsLeft()
|
||||
|
||||
@@ -400,17 +400,17 @@ namespace XCharts
|
||||
/// <summary>
|
||||
/// 运行时实际范围的开始值
|
||||
/// </summary>
|
||||
public float runtimeStartValue { get; internal set; }
|
||||
public double runtimeStartValue { get; internal set; }
|
||||
/// <summary>
|
||||
/// 运行时实际范围的结束值
|
||||
/// </summary>
|
||||
public float runtimeEndValue { get; internal set; }
|
||||
public double runtimeEndValue { get; internal set; }
|
||||
public bool runtimeInvert { get; set; }
|
||||
|
||||
class AxisIndexValueInfo
|
||||
{
|
||||
public float min;
|
||||
public float max;
|
||||
public double min;
|
||||
public double max;
|
||||
}
|
||||
private Dictionary<int, AxisIndexValueInfo> m_XAxisIndexInfos = new Dictionary<int, AxisIndexValueInfo>();
|
||||
private Dictionary<int, AxisIndexValueInfo> m_YAxisIndexInfos = new Dictionary<int, AxisIndexValueInfo>();
|
||||
@@ -660,7 +660,7 @@ namespace XCharts
|
||||
runtimeHeight = chartHeight - runtimeTop - runtimeBottom;
|
||||
}
|
||||
|
||||
internal void SetXAxisIndexValueInfo(int xAxisIndex, float min, float max)
|
||||
internal void SetXAxisIndexValueInfo(int xAxisIndex, double min, double max)
|
||||
{
|
||||
if (!m_XAxisIndexInfos.ContainsKey(xAxisIndex))
|
||||
{
|
||||
@@ -677,7 +677,7 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
internal void SetYAxisIndexValueInfo(int yAxisIndex, float min, float max)
|
||||
internal void SetYAxisIndexValueInfo(int yAxisIndex, double min, double max)
|
||||
{
|
||||
if (!m_YAxisIndexInfos.ContainsKey(yAxisIndex))
|
||||
{
|
||||
@@ -704,7 +704,7 @@ namespace XCharts
|
||||
return m_YAxisIndexInfos.ContainsKey(axisIndex);
|
||||
}
|
||||
|
||||
internal void GetXAxisIndexValue(int axisIndex, out float min, out float max)
|
||||
internal void GetXAxisIndexValue(int axisIndex, out double min, out double max)
|
||||
{
|
||||
min = 0;
|
||||
max = 0;
|
||||
@@ -715,7 +715,7 @@ namespace XCharts
|
||||
max = info.max;
|
||||
}
|
||||
}
|
||||
internal void GetYAxisIndexValue(int axisIndex, out float min, out float max)
|
||||
internal void GetYAxisIndexValue(int axisIndex, out double min, out double max)
|
||||
{
|
||||
min = 0;
|
||||
max = 0;
|
||||
@@ -1128,8 +1128,8 @@ namespace XCharts
|
||||
float scaleWid = dataZoom.runtimeWidth / (showData.Count - 1);
|
||||
Vector3 lp = Vector3.zero;
|
||||
Vector3 np = Vector3.zero;
|
||||
float minValue = 0;
|
||||
float maxValue = 0;
|
||||
double minValue = 0;
|
||||
double maxValue = 0;
|
||||
SeriesHelper.GetYMinMaxValue(chart.series, null, 0, chart.IsValue(), axis.inverse, out minValue, out maxValue);
|
||||
AxisHelper.AdjustMinMaxValue(axis, ref minValue, ref maxValue, true);
|
||||
|
||||
@@ -1143,11 +1143,11 @@ namespace XCharts
|
||||
var dataChanging = false;
|
||||
for (int i = 0; i < maxCount; i += rate)
|
||||
{
|
||||
float value = chart.SampleValue(ref showData, serie.sampleType, rate, serie.minShow, maxCount, totalAverage, i,
|
||||
double value = chart.SampleValue(ref showData, serie.sampleType, rate, serie.minShow, maxCount, totalAverage, i,
|
||||
serie.animation.GetUpdateAnimationDuration(), ref dataChanging, axis);
|
||||
float pX = dataZoom.runtimeX + i * scaleWid;
|
||||
float dataHig = (maxValue - minValue) == 0 ? 0 :
|
||||
(value - minValue) / (maxValue - minValue) * dataZoom.runtimeHeight;
|
||||
float dataHig = (float)((maxValue - minValue) == 0 ? 0 :
|
||||
(value - minValue) / (maxValue - minValue) * dataZoom.runtimeHeight);
|
||||
np = new Vector3(pX, chart.chartY + dataZoom.bottom + dataHig);
|
||||
if (i > 0)
|
||||
{
|
||||
@@ -1209,8 +1209,8 @@ namespace XCharts
|
||||
float scaleWid = dataZoom.runtimeHeight / (showData.Count - 1);
|
||||
Vector3 lp = Vector3.zero;
|
||||
Vector3 np = Vector3.zero;
|
||||
float minValue = 0;
|
||||
float maxValue = 0;
|
||||
double minValue = 0;
|
||||
double maxValue = 0;
|
||||
SeriesHelper.GetYMinMaxValue(chart.series, null, 0, chart.IsValue(), axis.inverse, out minValue, out maxValue);
|
||||
AxisHelper.AdjustMinMaxValue(axis, ref minValue, ref maxValue, true);
|
||||
|
||||
@@ -1224,11 +1224,11 @@ namespace XCharts
|
||||
var dataChanging = false;
|
||||
for (int i = 0; i < maxCount; i += rate)
|
||||
{
|
||||
float value = chart.SampleValue(ref showData, serie.sampleType, rate, serie.minShow, maxCount, totalAverage, i,
|
||||
double value = chart.SampleValue(ref showData, serie.sampleType, rate, serie.minShow, maxCount, totalAverage, i,
|
||||
serie.animation.GetUpdateAnimationDuration(), ref dataChanging, axis);
|
||||
float pY = dataZoom.runtimeY + i * scaleWid;
|
||||
float dataHig = (maxValue - minValue) == 0 ? 0 :
|
||||
(value - minValue) / (maxValue - minValue) * dataZoom.runtimeWidth;
|
||||
(float)((value - minValue) / (maxValue - minValue) * dataZoom.runtimeWidth);
|
||||
np = new Vector3(chart.chartX + chart.chartWidth - dataZoom.right - dataHig, pY);
|
||||
if (i > 0)
|
||||
{
|
||||
|
||||
@@ -54,8 +54,8 @@ namespace XCharts
|
||||
public class Indicator
|
||||
{
|
||||
[SerializeField] private string m_Name;
|
||||
[SerializeField] private float m_Max;
|
||||
[SerializeField] private float m_Min;
|
||||
[SerializeField] private double m_Max;
|
||||
[SerializeField] private double m_Min;
|
||||
[SerializeField] private TextStyle m_TextStyle = new TextStyle();
|
||||
|
||||
/// <summary>
|
||||
@@ -67,12 +67,12 @@ namespace XCharts
|
||||
/// The maximum value of indicator, with default value of 0, but we recommend to set it manually.
|
||||
/// 指示器的最大值,默认为 0 无限制。
|
||||
/// </summary>
|
||||
public float max { get { return m_Max; } set { m_Max = value; } }
|
||||
public double max { get { return m_Max; } set { m_Max = value; } }
|
||||
/// <summary>
|
||||
/// The minimum value of indicator, with default value of 0.
|
||||
/// 指示器的最小值,默认为 0 无限制。
|
||||
/// </summary>
|
||||
public float min { get { return m_Min; } set { m_Min = value; } }
|
||||
public double min { get { return m_Min; } set { m_Min = value; } }
|
||||
/// <summary>
|
||||
/// the style of text.
|
||||
/// 文本样式。
|
||||
@@ -276,7 +276,7 @@ namespace XCharts
|
||||
return true;
|
||||
}
|
||||
|
||||
public float GetIndicatorMin(int index)
|
||||
public double GetIndicatorMin(int index)
|
||||
{
|
||||
if (index >= 0 && index < m_IndicatorList.Count)
|
||||
{
|
||||
@@ -284,7 +284,7 @@ namespace XCharts
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public float GetIndicatorMax(int index)
|
||||
public double GetIndicatorMax(int index)
|
||||
{
|
||||
if (index >= 0 && index < m_IndicatorList.Count)
|
||||
{
|
||||
|
||||
@@ -324,7 +324,7 @@ namespace XCharts
|
||||
[SerializeField] private bool m_ShowDataIcon;
|
||||
[SerializeField] private bool m_Clip = false;
|
||||
[SerializeField] private bool m_Ignore = false;
|
||||
[SerializeField] private float m_IgnoreValue = 0;
|
||||
[SerializeField] private double m_IgnoreValue = 0;
|
||||
[SerializeField] private bool m_ShowAsPositiveNumber = false;
|
||||
[SerializeField] private bool m_Large = true;
|
||||
[SerializeField] private int m_LargeThreshold = 200;
|
||||
@@ -354,8 +354,8 @@ namespace XCharts
|
||||
|
||||
[NonSerialized] internal int m_FilterStart;
|
||||
[NonSerialized] internal int m_FilterEnd;
|
||||
[NonSerialized] internal float m_FilterStartValue;
|
||||
[NonSerialized] internal float m_FilterEndValue;
|
||||
[NonSerialized] internal double m_FilterStartValue;
|
||||
[NonSerialized] internal double m_FilterEndValue;
|
||||
[NonSerialized] internal int m_FilterMinShow;
|
||||
[NonSerialized] internal bool m_NeedUpdateFilterData;
|
||||
[NonSerialized] internal List<SerieData> m_FilterData = new List<SerieData>();
|
||||
@@ -763,7 +763,7 @@ namespace XCharts
|
||||
/// <summary>
|
||||
/// 忽略数据的默认值。当ignore为true才有效。
|
||||
/// </summary>
|
||||
public float ignoreValue
|
||||
public double ignoreValue
|
||||
{
|
||||
get { return m_IgnoreValue; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_IgnoreValue, value)) SetVerticesDirty(); }
|
||||
@@ -1137,18 +1137,18 @@ namespace XCharts
|
||||
/// <summary>
|
||||
/// 运行时的最大数据值
|
||||
/// </summary>
|
||||
public float runtimeDataMax { get; internal set; }
|
||||
public double runtimeDataMax { get; internal set; }
|
||||
/// <summary>
|
||||
/// 运行时的最小数据值
|
||||
/// </summary>
|
||||
public float runtimeDataMin { get; internal set; }
|
||||
public double runtimeDataMin { get; internal set; }
|
||||
/// <summary>
|
||||
/// 饼图的数据项之和
|
||||
/// </summary>
|
||||
public float runtimePieDataTotal { get; internal set; }
|
||||
public double runtimePieDataTotal { get; internal set; }
|
||||
public float runtimeWaveSpeed { get; internal set; }
|
||||
public Painter runtimeCanvas { get; internal set; }
|
||||
public float runtimeCheckValue { get; set; }
|
||||
public double runtimeCheckValue { get; set; }
|
||||
public int runtimeGridIndex { get; internal set; }
|
||||
public float runtimeX { get; internal set; }
|
||||
public float runtimeY { get; internal set; }
|
||||
@@ -1214,11 +1214,11 @@ namespace XCharts
|
||||
/// <summary>
|
||||
/// 维度Y对应数据中最大值。
|
||||
/// </summary>
|
||||
public float yMax
|
||||
public double yMax
|
||||
{
|
||||
get
|
||||
{
|
||||
float max = float.MinValue;
|
||||
var max = double.MinValue;
|
||||
foreach (var sdata in data)
|
||||
{
|
||||
if (sdata.show && sdata.data[1] > max)
|
||||
@@ -1233,11 +1233,11 @@ namespace XCharts
|
||||
/// <summary>
|
||||
/// 维度X对应数据中的最大值。
|
||||
/// </summary>
|
||||
public float xMax
|
||||
public double xMax
|
||||
{
|
||||
get
|
||||
{
|
||||
float max = float.MinValue;
|
||||
var max = double.MinValue;
|
||||
foreach (var sdata in data)
|
||||
{
|
||||
if (sdata.show && sdata.data[0] > max)
|
||||
@@ -1252,11 +1252,11 @@ namespace XCharts
|
||||
/// <summary>
|
||||
/// 维度Y对应数据的最小值。
|
||||
/// </summary>
|
||||
public float yMin
|
||||
public double yMin
|
||||
{
|
||||
get
|
||||
{
|
||||
float min = float.MaxValue;
|
||||
var min = double.MaxValue;
|
||||
foreach (var sdata in data)
|
||||
{
|
||||
if (sdata.show && sdata.data[1] < min)
|
||||
@@ -1271,11 +1271,11 @@ namespace XCharts
|
||||
/// <summary>
|
||||
/// 维度X对应数据的最小值。
|
||||
/// </summary>
|
||||
public float xMin
|
||||
public double xMin
|
||||
{
|
||||
get
|
||||
{
|
||||
float min = float.MaxValue;
|
||||
var min = double.MaxValue;
|
||||
foreach (var sdata in data)
|
||||
{
|
||||
if (sdata.show && sdata.data[0] < min)
|
||||
@@ -1290,11 +1290,11 @@ namespace XCharts
|
||||
/// <summary>
|
||||
/// 维度Y数据的总和。
|
||||
/// </summary>
|
||||
public float yTotal
|
||||
public double yTotal
|
||||
{
|
||||
get
|
||||
{
|
||||
float total = 0;
|
||||
double total = 0;
|
||||
foreach (var sdata in data)
|
||||
{
|
||||
if (sdata.show)
|
||||
@@ -1308,11 +1308,11 @@ namespace XCharts
|
||||
/// <summary>
|
||||
/// 维度X数据的总和。
|
||||
/// </summary>
|
||||
public float xTotal
|
||||
public double xTotal
|
||||
{
|
||||
get
|
||||
{
|
||||
float total = 0;
|
||||
double total = 0;
|
||||
foreach (var sdata in data)
|
||||
{
|
||||
if (sdata.show)
|
||||
@@ -1373,7 +1373,7 @@ namespace XCharts
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="dataName"></param>
|
||||
public SerieData AddYData(float value, string dataName = null)
|
||||
public SerieData AddYData(double value, string dataName = null)
|
||||
{
|
||||
CheckMaxCache();
|
||||
int xValue = m_Data.Count;
|
||||
@@ -1414,7 +1414,7 @@ namespace XCharts
|
||||
/// <param name="yValue"></param>
|
||||
/// <param name="dataName"></param>
|
||||
/// <param name="maxDataNumber"></param>
|
||||
public SerieData AddXYData(float xValue, float yValue, string dataName = null)
|
||||
public SerieData AddXYData(double xValue, double yValue, string dataName = null)
|
||||
{
|
||||
CheckMaxCache();
|
||||
var serieData = SerieDataPool.Get();
|
||||
@@ -1439,7 +1439,7 @@ namespace XCharts
|
||||
/// <param name="heighest"></param>
|
||||
/// <param name="dataName"></param>
|
||||
/// <returns></returns>
|
||||
public SerieData AddData(float open, float close, float lowest, float heighest, string dataName = null)
|
||||
public SerieData AddData(double open, double close, double lowest, double heighest, string dataName = null)
|
||||
{
|
||||
CheckMaxCache();
|
||||
var serieData = SerieDataPool.Get();
|
||||
@@ -1464,7 +1464,7 @@ namespace XCharts
|
||||
/// <param name="valueList"></param>
|
||||
/// <param name="dataName"></param>
|
||||
/// <param name="maxDataNumber"></param>
|
||||
public SerieData AddData(List<float> valueList, string dataName = null)
|
||||
public SerieData AddData(List<double> valueList, string dataName = null)
|
||||
{
|
||||
if (valueList == null || valueList.Count == 0) return null;
|
||||
if (valueList.Count == 1)
|
||||
@@ -1512,7 +1512,7 @@ namespace XCharts
|
||||
/// <param name="dimension"></param>
|
||||
/// <param name="dataZoom"></param>
|
||||
/// <returns></returns>
|
||||
public float GetData(int index, int dimension, DataZoom dataZoom = null)
|
||||
public double GetData(int index, int dimension, DataZoom dataZoom = null)
|
||||
{
|
||||
if (index < 0 || dimension < 0) return 0;
|
||||
var serieData = GetSerieData(index, dataZoom);
|
||||
@@ -1521,7 +1521,7 @@ namespace XCharts
|
||||
var value = serieData.GetData(dimension);
|
||||
if (showAsPositiveNumber)
|
||||
{
|
||||
value = Mathf.Abs(value);
|
||||
value = Math.Abs(value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
@@ -1537,7 +1537,7 @@ namespace XCharts
|
||||
/// <param name="index"></param>
|
||||
/// <param name="dataZoom"></param>
|
||||
/// <returns></returns>
|
||||
public float GetYData(int index, DataZoom dataZoom = null)
|
||||
public double GetYData(int index, DataZoom dataZoom = null)
|
||||
{
|
||||
if (index < 0) return 0;
|
||||
var serieData = GetDataList(dataZoom);
|
||||
@@ -1546,14 +1546,14 @@ namespace XCharts
|
||||
var value = serieData[index].data[1];
|
||||
if (showAsPositiveNumber)
|
||||
{
|
||||
value = Mathf.Abs(value);
|
||||
value = Math.Abs(value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public float GetYCurrData(int index, DataZoom dataZoom = null)
|
||||
public double GetYCurrData(int index, DataZoom dataZoom = null)
|
||||
{
|
||||
if (index < 0) return 0;
|
||||
var serieData = GetDataList(dataZoom);
|
||||
@@ -1562,7 +1562,7 @@ namespace XCharts
|
||||
var value = serieData[index].GetCurrData(1, animation.GetUpdateAnimationDuration());
|
||||
if (showAsPositiveNumber)
|
||||
{
|
||||
value = Mathf.Abs(value);
|
||||
value = Math.Abs(value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
@@ -1576,7 +1576,7 @@ namespace XCharts
|
||||
/// <param name="yData">对应的数据值</param>
|
||||
/// <param name="dataName">对应的数据名</param>
|
||||
/// <param name="dataZoom">区域缩放</param>
|
||||
public void GetYData(int index, out float yData, out string dataName, DataZoom dataZoom = null)
|
||||
public void GetYData(int index, out double yData, out string dataName, DataZoom dataZoom = null)
|
||||
{
|
||||
yData = 0;
|
||||
dataName = null;
|
||||
@@ -1587,7 +1587,7 @@ namespace XCharts
|
||||
yData = serieData[index].data[1];
|
||||
if (showAsPositiveNumber)
|
||||
{
|
||||
yData = Mathf.Abs(yData);
|
||||
yData = Math.Abs(yData);
|
||||
}
|
||||
dataName = serieData[index].name;
|
||||
}
|
||||
@@ -1616,7 +1616,7 @@ namespace XCharts
|
||||
/// <param name="dataZoom"></param>
|
||||
/// <param name="xValue"></param>
|
||||
/// <param name="yVlaue"></param>
|
||||
public void GetXYData(int index, DataZoom dataZoom, out float xValue, out float yVlaue)
|
||||
public void GetXYData(int index, DataZoom dataZoom, out double xValue, out double yVlaue)
|
||||
{
|
||||
xValue = 0;
|
||||
yVlaue = 0;
|
||||
@@ -1629,15 +1629,15 @@ namespace XCharts
|
||||
yVlaue = serieData.data[1];
|
||||
if (showAsPositiveNumber)
|
||||
{
|
||||
xValue = Mathf.Abs(xValue);
|
||||
yVlaue = Mathf.Abs(yVlaue);
|
||||
xValue = Math.Abs(xValue);
|
||||
yVlaue = Math.Abs(yVlaue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float GetDataTotal(int dimension)
|
||||
public double GetDataTotal(int dimension)
|
||||
{
|
||||
float total = 0;
|
||||
double total = 0;
|
||||
foreach (var sdata in data)
|
||||
{
|
||||
if (sdata.show)
|
||||
@@ -1670,7 +1670,7 @@ namespace XCharts
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="value"></param>
|
||||
public bool UpdateYData(int index, float value)
|
||||
public bool UpdateYData(int index, double value)
|
||||
{
|
||||
UpdateData(index, 1, value);
|
||||
return true;
|
||||
@@ -1695,7 +1695,7 @@ namespace XCharts
|
||||
/// <param name="index">要更新数据的索引</param>
|
||||
/// <param name="dimension">要更新数据的维数</param>
|
||||
/// <param name="value">新的数据值</param>
|
||||
public bool UpdateData(int index, int dimension, float value)
|
||||
public bool UpdateData(int index, int dimension, double value)
|
||||
{
|
||||
if (index >= 0 && index < m_Data.Count)
|
||||
{
|
||||
@@ -1716,7 +1716,7 @@ namespace XCharts
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="values"></param>
|
||||
public bool UpdateData(int index, List<float> values)
|
||||
public bool UpdateData(int index, List<double> values)
|
||||
{
|
||||
if (index >= 0 && index < m_Data.Count && values != null)
|
||||
{
|
||||
@@ -1847,9 +1847,9 @@ namespace XCharts
|
||||
return IsIgnoreValue(serieData.GetData(dimension));
|
||||
}
|
||||
|
||||
public bool IsIgnoreValue(float value)
|
||||
public bool IsIgnoreValue(double value)
|
||||
{
|
||||
return m_Ignore && Mathf.Approximately(value, m_IgnoreValue);
|
||||
return m_Ignore && MathUtil.Approximately(value, m_IgnoreValue);
|
||||
}
|
||||
|
||||
public bool IsIgnorePoint(int index)
|
||||
@@ -1940,8 +1940,8 @@ namespace XCharts
|
||||
for (int j = 0; j < data.Length; j++)
|
||||
{
|
||||
var txt = data[j].Trim().Replace("]", "");
|
||||
float value;
|
||||
var flag = float.TryParse(txt, out value);
|
||||
double value;
|
||||
var flag = double.TryParse(txt, out value);
|
||||
if (flag)
|
||||
{
|
||||
serieData.data.Add(value);
|
||||
@@ -1962,8 +1962,8 @@ namespace XCharts
|
||||
{
|
||||
if (a.StartsWith("value:"))
|
||||
{
|
||||
float value = float.Parse(a.Substring(6, a.Length - 6));
|
||||
serieData.data = new List<float>() { i, value };
|
||||
double value = double.Parse(a.Substring(6, a.Length - 6));
|
||||
serieData.data = new List<double>() { i, value };
|
||||
}
|
||||
else if (a.StartsWith("name:"))
|
||||
{
|
||||
@@ -1984,12 +1984,12 @@ namespace XCharts
|
||||
string[] datas = temp.Split(',');
|
||||
for (int i = 0; i < datas.Length; i++)
|
||||
{
|
||||
float value;
|
||||
var flag = float.TryParse(datas[i].Trim(), out value);
|
||||
double value;
|
||||
var flag = double.TryParse(datas[i].Trim(), out value);
|
||||
if (flag)
|
||||
{
|
||||
var serieData = new SerieData();
|
||||
serieData.data = new List<float>() { i, value };
|
||||
serieData.data = new List<double>() { i, value };
|
||||
AddSerieDataHeadOrTail(serieData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace XCharts
|
||||
/// <param name="serieIndex"></param>
|
||||
/// <param name="dataIndex"></param>
|
||||
/// <returns></returns>
|
||||
public float GetData(int serieIndex, int dataIndex)
|
||||
public double GetData(int serieIndex, int dataIndex)
|
||||
{
|
||||
if (serieIndex >= 0 && serieIndex < Count)
|
||||
{
|
||||
@@ -128,7 +128,7 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
public float GetCurrData(int serieIndex, int dataIndex)
|
||||
public double GetCurrData(int serieIndex, int dataIndex)
|
||||
{
|
||||
if (serieIndex >= 0 && serieIndex < Count)
|
||||
{
|
||||
@@ -321,7 +321,7 @@ namespace XCharts
|
||||
/// <param name="value"></param>
|
||||
/// <param name="dataName"></param>
|
||||
/// <returns>添加成功返回SerieData,否则返回null</returns>
|
||||
public SerieData AddData(string serieName, float value, string dataName = null)
|
||||
public SerieData AddData(string serieName, double value, string dataName = null)
|
||||
{
|
||||
var serie = GetSerie(serieName);
|
||||
if (serie != null)
|
||||
@@ -338,7 +338,7 @@ namespace XCharts
|
||||
/// <param name="value"></param>
|
||||
/// <param name="dataName"></param>
|
||||
/// <returns>添加成功返回SerieData,否则返回null</returns>
|
||||
public SerieData AddData(int index, float value, string dataName = null)
|
||||
public SerieData AddData(int index, double value, string dataName = null)
|
||||
{
|
||||
var serie = GetSerie(index);
|
||||
if (serie != null)
|
||||
@@ -358,7 +358,7 @@ namespace XCharts
|
||||
/// <param name="heighest"></param>
|
||||
/// <param name="dataName"></param>
|
||||
/// <returns></returns>
|
||||
public SerieData AddData(int index, float open, float close, float lowest, float heighest, string dataName = null)
|
||||
public SerieData AddData(int index, double open, double close, double lowest, double heighest, string dataName = null)
|
||||
{
|
||||
var serie = GetSerie(index);
|
||||
if (serie != null)
|
||||
@@ -368,7 +368,7 @@ namespace XCharts
|
||||
return null;
|
||||
}
|
||||
|
||||
public SerieData AddData(string serieName, float open, float close, float lowest, float heighest, string dataName = null)
|
||||
public SerieData AddData(string serieName, double open, double close, double lowest, double heighest, string dataName = null)
|
||||
{
|
||||
var serie = GetSerie(serieName);
|
||||
if (serie != null)
|
||||
@@ -385,7 +385,7 @@ namespace XCharts
|
||||
/// <param name="multidimensionalData"></param>
|
||||
/// <param name="dataName"></param>
|
||||
/// <returns>添加成功返回SerieData,否则返回null</returns>
|
||||
public SerieData AddData(string serieName, List<float> multidimensionalData, string dataName = null)
|
||||
public SerieData AddData(string serieName, List<double> multidimensionalData, string dataName = null)
|
||||
{
|
||||
var serie = GetSerie(serieName);
|
||||
if (serie != null)
|
||||
@@ -402,7 +402,7 @@ namespace XCharts
|
||||
/// <param name="multidimensionalData"></param>
|
||||
/// <param name="dataName"></param>
|
||||
/// <returns>添加成功返回SerieData,否则返回null</returns>
|
||||
public SerieData AddData(int serieIndex, List<float> multidimensionalData, string dataName = null)
|
||||
public SerieData AddData(int serieIndex, List<double> multidimensionalData, string dataName = null)
|
||||
{
|
||||
var serie = GetSerie(serieIndex);
|
||||
if (serie != null)
|
||||
@@ -420,7 +420,7 @@ namespace XCharts
|
||||
/// <param name="yValue"></param>
|
||||
/// <param name="dataName"></param>
|
||||
/// <returns>添加成功返回SerieData,否则返回null</returns>
|
||||
public SerieData AddXYData(string serieName, float xValue, float yValue, string dataName = null)
|
||||
public SerieData AddXYData(string serieName, double xValue, double yValue, string dataName = null)
|
||||
{
|
||||
var serie = GetSerie(serieName);
|
||||
if (serie != null)
|
||||
@@ -438,7 +438,7 @@ namespace XCharts
|
||||
/// <param name="yValue"></param>
|
||||
/// <param name="dataName"></param>
|
||||
/// <returns>添加成功返回SerieData,否则返回null</returns>
|
||||
public SerieData AddXYData(int index, float xValue, float yValue, string dataName = null)
|
||||
public SerieData AddXYData(int index, double xValue, double yValue, string dataName = null)
|
||||
{
|
||||
var serie = GetSerie(index);
|
||||
if (serie != null)
|
||||
@@ -454,7 +454,7 @@ namespace XCharts
|
||||
/// <param name="name"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="dataIndex"></param>
|
||||
public bool UpdateData(string serieName, int dataIndex, float value)
|
||||
public bool UpdateData(string serieName, int dataIndex, double value)
|
||||
{
|
||||
var serie = GetSerie(serieName);
|
||||
if (serie != null)
|
||||
@@ -502,7 +502,7 @@ namespace XCharts
|
||||
/// <param name="serieIndex"></param>
|
||||
/// <param name="dataIndex"></param>
|
||||
/// <param name="value"></param>
|
||||
public bool UpdateData(int serieIndex, int dataIndex, float value)
|
||||
public bool UpdateData(int serieIndex, int dataIndex, double value)
|
||||
{
|
||||
var serie = GetSerie(serieIndex);
|
||||
if (serie != null)
|
||||
@@ -512,7 +512,7 @@ namespace XCharts
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool UpdateData(string serieName, int dataIndex, List<float> values)
|
||||
public bool UpdateData(string serieName, int dataIndex, List<double> values)
|
||||
{
|
||||
var serie = GetSerie(serieName);
|
||||
if (serie != null)
|
||||
@@ -521,7 +521,7 @@ namespace XCharts
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public bool UpdateData(int serieIndex, int dataIndex, List<float> values)
|
||||
public bool UpdateData(int serieIndex, int dataIndex, List<double> values)
|
||||
{
|
||||
var serie = GetSerie(serieIndex);
|
||||
if (serie != null)
|
||||
@@ -538,7 +538,7 @@ namespace XCharts
|
||||
/// <param name="dataIndex">数据项</param>
|
||||
/// <param name="dimension">数据维数,从0开始</param>
|
||||
/// <param name="value">值</param>
|
||||
public bool UpdateData(int serieIndex, int dataIndex, int dimension, float value)
|
||||
public bool UpdateData(int serieIndex, int dataIndex, int dimension, double value)
|
||||
{
|
||||
var serie = GetSerie(serieIndex);
|
||||
if (serie != null)
|
||||
@@ -555,7 +555,7 @@ namespace XCharts
|
||||
/// <param name="dataIndex"></param>
|
||||
/// <param name="dimension">数据维数,从0开始</param>
|
||||
/// <param name="value"></param>
|
||||
public bool UpdateData(string serieName, int dataIndex, int dimension, float value)
|
||||
public bool UpdateData(string serieName, int dataIndex, int dimension, double value)
|
||||
{
|
||||
var serie = GetSerie(serieName);
|
||||
if (serie != null)
|
||||
|
||||
@@ -257,14 +257,14 @@ namespace XCharts
|
||||
/// the value for x indicator label.
|
||||
/// 指示器X轴上要显示的值。
|
||||
/// </summary>
|
||||
public float[] runtimeXValues { get { return m_RuntimeXValue; } internal set { m_RuntimeXValue = value; } }
|
||||
private float[] m_RuntimeXValue = new float[2] { -1, -1 };
|
||||
public double[] runtimeXValues { get { return m_RuntimeXValue; } internal set { m_RuntimeXValue = value; } }
|
||||
private double[] m_RuntimeXValue = new double[2] { -1, -1 };
|
||||
/// <summary>
|
||||
/// the value for y indicator label.
|
||||
/// 指示器Y轴上要显示的值。
|
||||
/// </summary>
|
||||
public float[] runtimeYValues { get { return m_RuntimeYValue; } internal set { m_RuntimeYValue = value; } }
|
||||
private float[] m_RuntimeYValue = new float[2] { -1, -1 };
|
||||
public double[] runtimeYValues { get { return m_RuntimeYValue; } internal set { m_RuntimeYValue = value; } }
|
||||
private double[] m_RuntimeYValue = new double[2] { -1, -1 };
|
||||
/// <summary>
|
||||
/// the current pointer position.
|
||||
/// 当前鼠标位置。
|
||||
|
||||
@@ -53,19 +53,19 @@ namespace XCharts
|
||||
[System.Serializable]
|
||||
public class Pieces
|
||||
{
|
||||
[SerializeField] private float m_Min;
|
||||
[SerializeField] private float m_Max;
|
||||
[SerializeField] private double m_Min;
|
||||
[SerializeField] private double m_Max;
|
||||
[SerializeField] private string m_Label;
|
||||
[SerializeField] private Color32 m_Color;
|
||||
|
||||
/// <summary>
|
||||
/// 范围最小值
|
||||
/// </summary>
|
||||
public float min { get { return m_Min; } set { m_Min = value; } }
|
||||
public double min { get { return m_Min; } set { m_Min = value; } }
|
||||
/// <summary>
|
||||
/// 范围最大值
|
||||
/// </summary>
|
||||
public float max { get { return m_Max; } set { m_Max = value; } }
|
||||
public double max { get { return m_Max; } set { m_Max = value; } }
|
||||
/// <summary>
|
||||
/// 文字描述
|
||||
/// </summary>
|
||||
@@ -75,10 +75,10 @@ namespace XCharts
|
||||
/// </summary>
|
||||
public Color32 color { get { return m_Color; } set { m_Color = value; } }
|
||||
|
||||
public bool Contains(float value, float minMaxRange)
|
||||
public bool Contains(double value, double minMaxRange)
|
||||
{
|
||||
var cmin = Mathf.Abs(m_Min) < 1 ? minMaxRange * m_Min : m_Min;
|
||||
var cmax = Mathf.Abs(m_Max) < 1 ? minMaxRange * m_Max : m_Max;
|
||||
var cmin = System.Math.Abs(m_Min) < 1 ? minMaxRange * m_Min : m_Min;
|
||||
var cmax = System.Math.Abs(m_Max) < 1 ? minMaxRange * m_Max : m_Max;
|
||||
return value >= cmin && value < cmax;
|
||||
}
|
||||
}
|
||||
@@ -87,10 +87,10 @@ namespace XCharts
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] private Type m_Type = Type.Continuous;
|
||||
[SerializeField] private SelectedMode m_SelectedMode = SelectedMode.Multiple;
|
||||
[SerializeField] private float m_Min = 0;
|
||||
[SerializeField] private float m_Max = 100f;
|
||||
[SerializeField] private double m_Min = 0;
|
||||
[SerializeField] private double m_Max = 100;
|
||||
|
||||
[SerializeField] private float[] m_Range = new float[2] { 0, 100f };
|
||||
[SerializeField] private double[] m_Range = new double[2] { 0, 100 };
|
||||
[SerializeField] private string[] m_Text = new string[2] { "", "" };
|
||||
[SerializeField] private float[] m_TextGap = new float[2] { 10f, 10f };
|
||||
[SerializeField] private int m_SplitNumber = 5;
|
||||
@@ -156,7 +156,7 @@ namespace XCharts
|
||||
///
|
||||
/// 允许的最小值。`autoMinMax`为`false`时必须指定。[visualMap.min, visualMap.max] 形成了视觉映射的『定义域』。
|
||||
/// </summary>
|
||||
public float min
|
||||
public double min
|
||||
{
|
||||
get { return m_Min; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Min, value)) SetVerticesDirty(); }
|
||||
@@ -166,7 +166,7 @@ namespace XCharts
|
||||
///
|
||||
/// 允许的最大值。`autoMinMax`为`false`时必须指定。[visualMap.min, visualMax.max] 形成了视觉映射的『定义域』。
|
||||
/// </summary>
|
||||
public float max
|
||||
public double max
|
||||
{
|
||||
get { return m_Max; }
|
||||
set { m_Max = (value < min ? min + 1 : value); SetVerticesDirty(); }
|
||||
@@ -176,7 +176,7 @@ namespace XCharts
|
||||
///
|
||||
/// 指定手柄对应数值的位置。range 应在[min,max]范围内。
|
||||
/// </summary>
|
||||
public float[] range { get { return m_Range; } }
|
||||
public double[] range { get { return m_Range; } }
|
||||
/// <summary>
|
||||
/// Text on both ends.
|
||||
/// 两端的文本,如 ['High', 'Low']。
|
||||
@@ -356,14 +356,14 @@ namespace XCharts
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public int runtimeSelectedIndex { get; set; }
|
||||
public float runtimeSelectedValue { get; set; }
|
||||
public double runtimeSelectedValue { get; set; }
|
||||
/// <summary>
|
||||
/// the current pointer position.
|
||||
/// 当前鼠标位置。
|
||||
/// </summary>
|
||||
public Vector2 runtimePointerPos { get; set; }
|
||||
public bool runtimeIsVertical { get { return orient == Orient.Vertical; } }
|
||||
public float rangeMin
|
||||
public double rangeMin
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -376,7 +376,7 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
public float rangeMax
|
||||
public double rangeMax
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -398,8 +398,8 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
public float runtimeRangeMinHeight { get { return (rangeMin - min) / (max - min) * itemHeight; } }
|
||||
public float runtimeRangeMaxHeight { get { return (rangeMax - min) / (max - min) * itemHeight; } }
|
||||
public float runtimeRangeMinHeight { get { return (float)((rangeMin - min) / (max - min) * itemHeight); } }
|
||||
public float runtimeRangeMaxHeight { get { return (float)((rangeMax - min) / (max - min) * itemHeight); } }
|
||||
public bool runtimeMinDrag { get; internal set; }
|
||||
public bool runtimeMaxDrag { get; internal set; }
|
||||
|
||||
@@ -440,7 +440,7 @@ namespace XCharts
|
||||
}
|
||||
else
|
||||
{
|
||||
var rate = (rtValue - inValue) / diff1;
|
||||
var rate = (float)((rtValue - inValue) / diff1);
|
||||
m_RtInRange.Add(Color32.Lerp(m_InRange[inCount], m_InRange[inCount + 1], rate));
|
||||
}
|
||||
}
|
||||
@@ -450,7 +450,7 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
public Color32 GetColor(float value)
|
||||
public Color32 GetColor(double value)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@@ -463,7 +463,7 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
private Color32 GetPiecesColor(float value)
|
||||
private Color32 GetPiecesColor(double value)
|
||||
{
|
||||
foreach (var piece in m_Pieces)
|
||||
{
|
||||
@@ -476,7 +476,7 @@ namespace XCharts
|
||||
else return ChartConst.clearColor32;
|
||||
}
|
||||
|
||||
private Color32 GetContinuousColor(float value)
|
||||
private Color32 GetContinuousColor(double value)
|
||||
{
|
||||
if (value < m_Min || value > m_Max)
|
||||
{
|
||||
@@ -498,15 +498,15 @@ namespace XCharts
|
||||
var nowMin = m_Min + index * diff;
|
||||
var rate = (value - nowMin) / diff;
|
||||
if (index == splitNumber - 1) return runtimeInRange[index];
|
||||
else return Color32.Lerp(runtimeInRange[index], runtimeInRange[index + 1], rate);
|
||||
else return Color32.Lerp(runtimeInRange[index], runtimeInRange[index + 1], (float)rate);
|
||||
}
|
||||
}
|
||||
|
||||
public int GetIndex(float value)
|
||||
public int GetIndex(double value)
|
||||
{
|
||||
int splitNumber = runtimeInRange.Count;
|
||||
if (splitNumber <= 0) return -1;
|
||||
value = Mathf.Clamp(value, m_Min, m_Max);
|
||||
value = MathUtil.Clamp(value, m_Min, m_Max);
|
||||
|
||||
var diff = (m_Max - m_Min) / (splitNumber - 1);
|
||||
var index = -1;
|
||||
@@ -526,7 +526,7 @@ namespace XCharts
|
||||
return m_Type == VisualMap.Type.Piecewise;
|
||||
}
|
||||
|
||||
public bool IsInSelectedValue(float value)
|
||||
public bool IsInSelectedValue(double value)
|
||||
{
|
||||
if (runtimeSelectedIndex < 0) return true;
|
||||
else
|
||||
@@ -535,7 +535,7 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
public float GetValue(Vector3 pos, Rect chartRect)
|
||||
public double GetValue(Vector3 pos, Rect chartRect)
|
||||
{
|
||||
var centerPos = new Vector3(chartRect.x, chartRect.y) + location.GetPosition(chartRect.width, chartRect.height);
|
||||
var pos1 = centerPos + (runtimeIsVertical ? Vector3.down : Vector3.left) * itemHeight / 2;
|
||||
@@ -726,7 +726,7 @@ namespace XCharts
|
||||
var halfHig = visualMap.itemHeight / 2;
|
||||
var centerPos = chart.chartPosition + visualMap.location.GetPosition(chart.chartWidth, chart.chartHeight);
|
||||
var selectedIndex = -1;
|
||||
var value = 0f;
|
||||
double value = 0;
|
||||
switch (visualMap.orient)
|
||||
{
|
||||
case Orient.Horizonal:
|
||||
|
||||
Reference in New Issue
Block a user