diff --git a/Source/Charts/Renderers/AxisRendererBase.swift b/Source/Charts/Renderers/AxisRendererBase.swift index 19ebf9527e..14cd25ee4d 100644 --- a/Source/Charts/Renderers/AxisRendererBase.swift +++ b/Source/Charts/Renderers/AxisRendererBase.swift @@ -119,7 +119,8 @@ open class AxisRendererBase: Renderer if intervalSigDigit > 5 { // Use one order of magnitude higher, to avoid intervals like 0.9 or 90 - interval = floor(10.0 * Double(intervalMagnitude)) + // if it's 0.0 after floor(), we use the old value + interval = floor(10.0 * intervalMagnitude) == 0.0 ? interval : floor(10.0 * intervalMagnitude) } var n = axis.centerAxisLabelsEnabled ? 1 : 0 diff --git a/Source/Charts/Renderers/YAxisRendererRadarChart.swift b/Source/Charts/Renderers/YAxisRendererRadarChart.swift index 0e5efd23c5..5247d6c2a7 100644 --- a/Source/Charts/Renderers/YAxisRendererRadarChart.swift +++ b/Source/Charts/Renderers/YAxisRendererRadarChart.swift @@ -56,9 +56,9 @@ open class YAxisRendererRadarChart: YAxisRenderer if intervalSigDigit > 5 { - // Use one order of magnitude higher, to avoid intervals like 0.9 or - // 90 - interval = floor(10 * intervalMagnitude) + // Use one order of magnitude higher, to avoid intervals like 0.9 or 90 + // if it's 0.0 after floor(), we use the old value + interval = floor(10.0 * intervalMagnitude) == 0.0 ? interval : floor(10.0 * intervalMagnitude) } let centeringEnabled = axis.isCenterAxisLabelsEnabled