-
-
Notifications
You must be signed in to change notification settings - Fork 6k
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
ChartYAxis valueFormatter NSFormatter instead of NSNumberFormatter #228
Comments
Y values are number, hence |
It would be great to support other formatter types because subclassing NSNumberFormatter and overriding
is a bit awkward if you're creating a new formatter type in that function to for example parse dates. |
@mathiasgithub but y axis is meant to be numbers, right? I don't know if the y axis is about dates, how do you draw the charts? What's the meaning? Any examples? |
@liuxuan30 here's one of the formatters I would love to be able to use:
I use it to convert seconds (Int) to a string with the format MM:SS I think it's useful to be able to represent the values on the y axis in any way you might want. NSNumberFormatter limits that. NSDateComponentsFormatter inherits from NSFormatter |
I see. It will calculate the y axis range to determine how we draw the chart. We cannot change it to NSFormatter, since it does not provide a default implementation for converting from double values. We could provide one, but seems it requires a decent work on it, without a high priority. If you want this support, you are more than welcome to file a PR :) |
Thank you! No problem, I understand. I’ll see what I can do with that PR Cheers
|
Once you have the data you need to place the y-axis labels on the line in order, why do you need the value formatter be a NSNumberFormatter as opposed to just a NSFormatter. The reason I ask is I'm trying to plot times and I'd like to be able to show it in MM:SS format instead of minute.fraction format.
The same could be true with the labels placed above/below the data points.
The text was updated successfully, but these errors were encountered: