ChartsOrg / ChartsOrg/Charts

custom axisValueFormatter is always getting unset

Open
#1,853 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Swift
Stars
28k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

I made a custom formatter that inherits from DefaultAxisValueFormatter so that I can print out custom labels, and I'm setting my xAxis.valueFormatter to this custom formatter. However, the get code is always re-setting it to the DefaultAxisValueFormatter because these conditions are always being met:

~~~~
get
{
if _axisValueFormatter == nil ||
(_axisValueFormatter is DefaultAxisValueFormatter &&
(_axisValueFormatter as! DefaultAxisValueFormatter).hasAutoDecimals &&
(_axisValueFormatter as! DefaultAxisValueFormatter).decimals != decimals)
{
_axisValueFormatter = DefaultAxisValueFormatter(decimals: decimals)
}

return _axisValueFormatter
}
~~~~

I got around it by not inheriting, but it seems like an issue others might run into too.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.