Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overriding DefaultAxisValueFormatter Doesn't Work #4365

Closed
1 task done
giantramen opened this issue May 11, 2020 · 0 comments
Closed
1 task done

Overriding DefaultAxisValueFormatter Doesn't Work #4365

giantramen opened this issue May 11, 2020 · 0 comments

Comments

@giantramen
Copy link

What did you do?

Overrode Default Axis Formatter

class InvertedAxisFormatter: DefaultAxisValueFormatter {

    @objc override func stringForValue(_ value: Double, axis: AxisBase?) -> String {
        return super.stringForValue(value.isAlmostZero() ? 0 : -value, axis: axis)
    }
}

What did you expect to happen?

My method gets called.

What happened instead?

The getter for the base formatter checks if the decimals match and replaces my formatter.

Charts Environment

Charts version/Branch/Commit Number: 7ac4a05
Xcode version: 11.3.1
Swift version: 5.0
Platform(s) running Charts: iOS
macOS version running Xcode: 10.15.4

liuxuan30 added a commit that referenced this issue Jun 22, 2020
Fix AxisBase Formatter Getter (Fixes #4365)
mosaic-engineering pushed a commit to mosaic-io/Charts that referenced this issue Dec 3, 2020
Fixes issue where if you overrode the
formatter it didn't matter because a new one would
just replace it.
mosaic-engineering pushed a commit to mosaic-io/Charts that referenced this issue Dec 3, 2020
SwiftPolar pushed a commit to SwiftPolar/Charts that referenced this issue Mar 20, 2023
Fixes issue where if you overrode the
formatter it didn't matter because a new one would
just replace it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant