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

Getting strange behaviour when value goes above 10? #41

Open
Alifar opened this issue Jun 20, 2017 · 0 comments
Open

Getting strange behaviour when value goes above 10? #41

Alifar opened this issue Jun 20, 2017 · 0 comments

Comments

@Alifar
Copy link

Alifar commented Jun 20, 2017

schermafbeelding 2017-06-20 om 22 46 41

See image, why am I getting this behaviour when it goes up 10?

See my code below:

float n = [[sort objectAtIndex:0] floatValue];
        
        NSString* forFloat = [NSString stringWithFormat:@"%.3f", n];
        lowFloat = [forFloat floatValue]-0.001;

NSMutableArray* chartData = [NSMutableArray arrayWithCapacity:self.lineData.count];
            NSMutableArray* months = [NSMutableArray arrayWithCapacity:self.lineData.count];
            for(int i=0;i<self.lineData.count;i++) {
                
                Kobject *z = [self.lineData objectAtIndex:i];
                chartData[i] = [NSNumber numberWithFloat:[z.oPrice floatValue]-lowFloat];
                months[i] = z.oDate;
            }
            
            self.lineChart = [[FSLineChart alloc] initWithFrame:CGRectMake(15, 44, [UIScreen mainScreen].bounds.size.width - 30, 120)];
            self.lineChart.verticalGridStep = 6;
            self.lineChart.horizontalGridStep = 7;
            self.lineChart.fillColor = [UIColor colorWithRed:0.24 green:0.72 blue:0.68 alpha:0.20];
            self.lineChart.color = [self.lineChart.dataPointColor colorWithAlphaComponent:0.3];
            self.lineChart.valueLabelPosition = ValueLabelLeftMirrored;
            self.lineChart.indexLabelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:10];
            self.lineChart.valueLabelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:9];
            self.lineChart.labelForIndex = ^(NSUInteger item) {
                return months[item];
            };
            self.lineChart.labelForValue = ^(CGFloat value) {
                
                return [NSString stringWithFormat:@"$ %.2f", value+lowFloat];
            };
            [self.lineChart setChartData:chartData];
            [view addSubview:self.lineChart];
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

1 participant