You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@objc open var valueFormatter: IAxisValueFormatter?
{
get
{
if _axisValueFormatter is DefaultAxisValueFormatter,
(_axisValueFormatter as! DefaultAxisValueFormatter).hasAutoDecimals,
(_axisValueFormatter as! DefaultAxisValueFormatter).decimals != decimals
{
_axisValueFormatter = DefaultAxisValueFormatter(decimals: decimals)
}
return _axisValueFormatter
}
set
{
_axisValueFormatter = newValue ?? DefaultAxisValueFormatter(decimals: decimals)
}
}
If we allow custom formatters, then why do we reset the formatter if it's using a modified DefaultAxisValueFormatter? Any subclasses of DefaultAxisValueFormatter would also trigger this reset. I feel we should either not allow custom formatters, or provide an implementation like this:
@objc open var valueFormatter: IAxisValueFormatter?
{
get { return _axisValueFormatter }
set { _axisValueFormatter = newValue ?? DefaultAxisValueFormatter(decimals: decimals) }
}
The text was updated successfully, but these errors were encountered:
I guess because DefaultAxisValueFormatter is kind of a demo formatter, or default one. People who want to customize usually does not subclass DefaultAxisValueFormatter?
allowing custom formatters is fine, since it's just a protocol.
Anyway, what confuses me now is the getter struggling with decimals, which I don't remember why..
if changing it won't trigger any CI failures, I think it's fine to go ahead.
valueFormatter
is implemented as so:If we allow custom formatters, then why do we reset the formatter if it's using a modified
DefaultAxisValueFormatter
? Any subclasses ofDefaultAxisValueFormatter
would also trigger this reset. I feel we should either not allow custom formatters, or provide an implementation like this:The text was updated successfully, but these errors were encountered: