Skip to content
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

How do i set #1818

Closed
multinerd opened this issue Nov 10, 2016 · 5 comments
Closed

How do i set #1818

multinerd opened this issue Nov 10, 2016 · 5 comments

Comments

@multinerd
Copy link

multinerd commented Nov 10, 2016

previously (2.2.5?) i was using the code below to set my labels at the bottom with dates. how can i do this with 3.0?

NSMutableArray<NSString *> *dates = [NSMutableArray array];
divChartData = [[CombinedChartData alloc] initWithXVals:dates];
@multinerd
Copy link
Author

multinerd commented Nov 10, 2016

i figured it out

- (NSString *)stringForValue:(double)value axis:(ChartAxisBase *)axis{
    return dates[(int)value % dates.count];
}

and

cell.chartView.xAxis.valueFormatter = self;

Previously i was able to get my data, put them into entries, entries into dataset all in one method, now with stringForValue:axis: my dates array has to be an instance variable. Is there any specific reason for such a change?

@pmairoldi
Copy link
Collaborator

If you look at the release notes for 3.0 there might be the reasoning there. I don't remember off the top of my head.

@edalford11
Copy link

Theres no reasoning for this on the release notes. Though I'm sure there was good reason for this, it'd be nice to know what that is because from a user standpoint, it's kind of a head ache.

@pmairoldi
Copy link
Collaborator

The reasoning is that you don't pass the x values you want on the axis anymore. You pass the x values in the entry and then format the axis to show the value. The reason was to better handle floating point values.

@multinerd
Copy link
Author

ah ok, that does make sense i guess. thanks for the explanation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants