-
-
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
Convert x value labels to String? from Double? [Horizontal Barchart] (Swift v3) #1527
Comments
@sree127 You can use NSTimeInterval to store date, then use a formatter to custom it. |
Hi @Huang-Libo. Thanks for replying. Can xaxis values take any String values? There are no examples in demo on how to use |
|
Thanks a lot @Huang-Libo. That was easier than I'd thought :-) |
This is what I spent a lot of time trying to figure out. I used a website to convert obj-c code to swift. Still can't get any of it to work properly. All I want is A, B, C, D on the xAxis. Thanks in advance to helpers. `import UIKit class ViewController: UIViewController, ChartViewDelegate {
}` |
Hey @nhantrivinh, you're setting the
And while setting the data :
|
@nhantrivinh use the code that @sree127 provided above and dont forget to set |
@tuantmdev What if I generate the string on the go, or outside the class? |
@jorgemauricio Pass the name values as a property of the Formatter
Just remember set formatter before set |
Can anyone help me? I tried to follow the ChartsDemo example and the suggestions here, but my horizontal bar chart is still coming out wrong. I'll include my code, basically I'm trying to label each bar with a bit of text, but I'm getting labels on the gridlines instead of one label for each bar. To set up the chart... ` double barWidth = 6.0;
` My stringForValue function where dataList is my NSArray of label strings... `- (NSString *)stringForValue:(double)value }` |
@Carielle
In your case, i think it should change to
|
@Carielle |
@sree127 |
I'm not able to figure out how to convert the x value labels to String?
Is it possible to convert the values to
["Jan", "Feb", "Mar"]
instead of [1, 2, 3].. ?The text was updated successfully, but these errors were encountered: