Skip to content

Commit

Permalink
Fix AxisBase Formatter Getter (Fixes ChartsOrg#4365)
Browse files Browse the repository at this point in the history
Fixes issue where if you overrode the
formatter it didn't matter because a new one would
just replace it.
  • Loading branch information
Grant Kamin authored and SwiftPolar committed Mar 20, 2023
1 parent df28e48 commit e36e90a
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Source/Charts/Components/AxisBase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e36e90a

Please sign in to comment.