-
-
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
Custom Y Value Formatter #943
Comments
Have you looked at the example for stacked bar chart view controller? I imagine it is similar where you pass a formatter?
|
@dxclancy pointed it out. Be aware it's a number formatter right now, so you may need write some code to bridge the number and date formatter. |
Hi there, Thanks your answer. Unfortunately, leftAxis.valueformatter only accepts NSNumberFormatter. I am trying to use the ChartDefaultXAxisValueFormatter as in the swift files, but I cannot manage to implement it. What is need is to display the left(Y) axis as time ex = 1:02:58 Alexis |
Hi, I assume what you want is to pass an NSDateFormatter? I see this in the definition: So you need to have one of your classes implement that protocol
or
or the swift equivalent. But it sounds like you want to format the yVals, which means you only have access to a NSNumberFormatter. Right? We are actually having a discussion about a similar issue to this in #742. However, @danielgindi 's position currently seems to be that this is incorrect. So I think you have 3 options.
Note that I'm fairly new to this wonderful library which has a lot of great options I'm unfamiliar with, so I may be missing something obvious. |
your suggestions are appreciated. We need to think carefully if we want to move the axis formatter to formatters. Thinking that all the data is naturally numbers, we think number formatter is the formatter to use. In case you want to display different strings from the value, you can customize your own. But the formatter's source is number for sure. |
I used the override method. It worked like a charm! |
We will, however, move forward with having our own interface which passes more information along with the value (the |
Having said that - this issue should stay open until we implement the protocol for a Y axis value formatter. |
Implemented in Charts 3.0 (v3 branch) |
I achieved it by inheriting
create YAxisValueFormatterclass, and assign object to graph leftAxis
|
When I inherit IAxisValueFormatter as stated above, I get an error: "No type or protocol named 'IChartAxisValueFormatter'" in my ProjectName-Swift.h file. |
First of all, this IOS Library is awesome! Thanks.
I have to display Y values in a BarChart in time format (mn:ss)
I have seen on the IOS documentation that a class called "ChartDefaultXAxisValueFormatter", but I can not find a way to use it.
Have anyone achieved such a thing?
Alexis
The text was updated successfully, but these errors were encountered: