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