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 mkchoi212 committed Dec 3, 2020
1 parent 3fe5fb4 commit abcc049
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 abcc049

Please sign in to comment.