mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-29 12:48:47 +00:00
修复数据过小时AxisLabel直接科学计数法显示的问题
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
|
* (2019.12.06) 修复数据过小时`AxisLabel`直接科学计数法显示的问题
|
||||||
* (2019.12.04) 优化和完善数据更新`UpdateData`接口
|
* (2019.12.04) 优化和完善数据更新`UpdateData`接口
|
||||||
* (2019.12.03) 增加圆环饼图的圆角支持,参数:`serie.arcShaped`
|
* (2019.12.03) 增加圆环饼图的圆角支持,参数:`serie.arcShaped`
|
||||||
* (2019.12.03) 增加数据更新动画,参数:`serie.animation.updateAnimation`
|
* (2019.12.03) 增加数据更新动画,参数:`serie.animation.updateAnimation`
|
||||||
|
|||||||
@@ -154,7 +154,8 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
int minAcc = ChartHelper.GetFloatAccuracy(minValue);
|
int minAcc = ChartHelper.GetFloatAccuracy(minValue);
|
||||||
int maxAcc = ChartHelper.GetFloatAccuracy(maxValue);
|
int maxAcc = ChartHelper.GetFloatAccuracy(maxValue);
|
||||||
int acc = Mathf.Max(minAcc, maxAcc);
|
int curAcc = ChartHelper.GetFloatAccuracy(value);
|
||||||
|
int acc = Mathf.Max(Mathf.Max(minAcc, maxAcc), curAcc);
|
||||||
return ChartCached.FloatToStr(value, acc, m_ForceENotation);
|
return ChartCached.FloatToStr(value, acc, m_ForceENotation);
|
||||||
}
|
}
|
||||||
else if (value - (int)value == 0)
|
else if (value - (int)value == 0)
|
||||||
@@ -181,7 +182,9 @@ namespace XCharts
|
|||||||
content = content.Replace("\\n", "\n");
|
content = content.Replace("\\n", "\n");
|
||||||
content = content.Replace("<br/>", "\n");
|
content = content.Replace("<br/>", "\n");
|
||||||
return content;
|
return content;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
return value.ToString(m_Formatter);
|
return value.ToString(m_Formatter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace XCharts
|
|||||||
[SerializeField] private float m_Duration = 1000;
|
[SerializeField] private float m_Duration = 1000;
|
||||||
[SerializeField] private int m_Threshold = 2000;
|
[SerializeField] private int m_Threshold = 2000;
|
||||||
[SerializeField] private float m_Delay = 0;
|
[SerializeField] private float m_Delay = 0;
|
||||||
[SerializeField] private bool m_UpdateAnimation = false;
|
[SerializeField] private bool m_UpdateAnimation = true;
|
||||||
[SerializeField] private float m_UpdateDuration = 500;
|
[SerializeField] private float m_UpdateDuration = 500;
|
||||||
[SerializeField] private float m_ActualDuration;
|
[SerializeField] private float m_ActualDuration;
|
||||||
|
|
||||||
|
|||||||
@@ -41,9 +41,9 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (f == 0) valueDic[value] = forceE ? value.ToString("E") : value.ToString();
|
if (f == 0) valueDic[value] = forceE ? value.ToString("E0") : value.ToString();
|
||||||
else if (f == 1) valueDic[value] = value.ToString("f1");
|
else if (f == 1) valueDic[value] = forceE ? value.ToString("E1") : value.ToString("f1");
|
||||||
else if (f == 2) valueDic[value] = value.ToString("f2");
|
else if (f == 2) valueDic[value] = forceE ? value.ToString("E2") : value.ToString("f2");
|
||||||
else valueDic[value] = (f > 3 || forceE) ? value.ToString("E0") : value.ToString(GetFn(f));
|
else valueDic[value] = (f > 3 || forceE) ? value.ToString("E0") : value.ToString(GetFn(f));
|
||||||
return valueDic[value];
|
return valueDic[value];
|
||||||
}
|
}
|
||||||
@@ -103,9 +103,9 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string GetAxisLabelName(string prefix, bool isYAxis,int axisIndex, int i)
|
internal static string GetAxisLabelName(string prefix, bool isYAxis, int axisIndex, int i)
|
||||||
{
|
{
|
||||||
int key = (isYAxis?2:1) * 1000000 + (axisIndex+1) * 100000 + i;
|
int key = (isYAxis ? 2 : 1) * 1000000 + (axisIndex + 1) * 100000 + i;
|
||||||
if (s_AxisLabelName.ContainsKey(key))
|
if (s_AxisLabelName.ContainsKey(key))
|
||||||
{
|
{
|
||||||
return s_AxisLabelName[key];
|
return s_AxisLabelName[key];
|
||||||
|
|||||||
@@ -513,7 +513,8 @@ namespace XCharts
|
|||||||
count++;
|
count++;
|
||||||
intvalue = (int)(value * Mathf.Pow(10, count));
|
intvalue = (int)(value * Mathf.Pow(10, count));
|
||||||
}
|
}
|
||||||
return count;
|
if (count == 12 && (value == 0 || value == 1)) return 1;
|
||||||
|
else return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddEventListener(GameObject obj, EventTriggerType type,
|
public static void AddEventListener(GameObject obj, EventTriggerType type,
|
||||||
|
|||||||
Reference in New Issue
Block a user