mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-16 13:30:10 +00:00
修复最大值小于10的浮点数图表显示异常
This commit is contained in:
@@ -483,7 +483,7 @@ namespace XCharts
|
||||
public static int GetMaxDivisibleValue(float max)
|
||||
{
|
||||
if (max == 0) return 0;
|
||||
int bigger = (int)Mathf.Abs(max);
|
||||
int bigger = Mathf.CeilToInt(Mathf.Abs(max));
|
||||
int n = 1;
|
||||
while (bigger / (Mathf.Pow(10, n)) > 10)
|
||||
{
|
||||
@@ -495,14 +495,14 @@ namespace XCharts
|
||||
mm = bigger - bigger % (Mathf.Pow(10, n));
|
||||
mm += max > 0 ? Mathf.Pow(10, n) : -Mathf.Pow(10, n);
|
||||
}
|
||||
if (max < 0) return (int)-mm;
|
||||
else return (int)mm;
|
||||
if (max < 0) return -Mathf.CeilToInt(mm);
|
||||
else return Mathf.CeilToInt(mm);
|
||||
}
|
||||
|
||||
public static int GetMinDivisibleValue(float min)
|
||||
{
|
||||
if (min == 0) return 0;
|
||||
int bigger = (int)Mathf.Abs(min);
|
||||
int bigger = Mathf.FloorToInt(Mathf.Abs(min));
|
||||
int n = 1;
|
||||
while (bigger / (Mathf.Pow(10, n)) > 10)
|
||||
{
|
||||
@@ -514,11 +514,8 @@ namespace XCharts
|
||||
mm = bigger - bigger % (Mathf.Pow(10, n));
|
||||
mm += min < 0 ? Mathf.Pow(10, n) : -Mathf.Pow(10, n);
|
||||
}
|
||||
if (min < 0)
|
||||
{
|
||||
return (int)-mm;
|
||||
}
|
||||
else return (int)mm;
|
||||
if (min < 0) return -Mathf.FloorToInt(mm);
|
||||
else return Mathf.FloorToInt(mm);
|
||||
}
|
||||
|
||||
public static void AddEventListener(GameObject obj, EventTriggerType type,
|
||||
|
||||
Reference in New Issue
Block a user