diff --git a/Source/Charts/Components/AxisBase.swift b/Source/Charts/Components/AxisBase.swift index d5b653943e..0b59628d4f 100644 --- a/Source/Charts/Components/AxisBase.swift +++ b/Source/Charts/Components/AxisBase.swift @@ -166,14 +166,17 @@ open class AxisBase: ComponentBase { get { - if _axisValueFormatter == nil || - (_axisValueFormatter is DefaultAxisValueFormatter && - (_axisValueFormatter as! DefaultAxisValueFormatter).hasAutoDecimals && - (_axisValueFormatter as! DefaultAxisValueFormatter).decimals != decimals) + if _axisValueFormatter == nil { _axisValueFormatter = DefaultAxisValueFormatter(decimals: decimals) } - + else if _axisValueFormatter is DefaultAxisValueFormatter && + (_axisValueFormatter as! DefaultAxisValueFormatter).hasAutoDecimals && + (_axisValueFormatter as! DefaultAxisValueFormatter).decimals != decimals + { + (self._axisValueFormatter as! DefaultAxisValueFormatter).decimals = self.decimals + } + return _axisValueFormatter } set