From 105637fb64ab59504bddbfeb7952c818cb35d0c0 Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Tue, 18 Jun 2019 02:42:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9C=80=E5=A4=A7=E5=80=BC?= =?UTF-8?q?=E5=B0=8F=E4=BA=8E10=E7=9A=84=E6=B5=AE=E7=82=B9=E6=95=B0?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Scripts/UI/Internal/Series.cs | 4 ++-- Scripts/UI/Utility/ChartHelper.cs | 15 ++++++--------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Scripts/UI/Internal/Series.cs b/Scripts/UI/Internal/Series.cs index d5e30034..0f186223 100644 --- a/Scripts/UI/Internal/Series.cs +++ b/Scripts/UI/Internal/Series.cs @@ -235,8 +235,8 @@ namespace XCharts } else { - minVaule = (int)min; - maxValue = (int)max; + minVaule = Mathf.FloorToInt(min); + maxValue = Mathf.CeilToInt(max); } } diff --git a/Scripts/UI/Utility/ChartHelper.cs b/Scripts/UI/Utility/ChartHelper.cs index 6354ea47..afce7241 100644 --- a/Scripts/UI/Utility/ChartHelper.cs +++ b/Scripts/UI/Utility/ChartHelper.cs @@ -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,