We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I followed the tutorial and had a problem with bar height. Every time one bar has zero height (not showing in a view).
This is my code:
(void)viewDidLoad { [super viewDidLoad]; // data array _data = @[@20, @30, @50];
JBBarChartView *barChartView = [[JBBarChartView alloc] init]; barChartView.delegate = self; barChartView.dataSource = self; barChartView.frame = CGRectMake(20, 120, 280, 200); barChartView.autoresizingMask = UIViewAutoresizingFlexibleWidth; barChartView.layer.borderWidth = 1; [self.view addSubview:barChartView];
[barChartView reloadData]; }
(NSUInteger)numberOfBarsInBarChartView:(JBBarChartView *)barChartView{ NSLog(@"numberOfBarsInBarChartView: %lu", (unsigned long)[self.data count]); return [self.data count]; }
(CGFloat)barChartView:(JBBarChartView *)barChartView heightForBarViewAtAtIndex:(NSUInteger)index{ NSLog(@"heightForBarViewAtAtIndex: %lu, height: %f", index, [[self.data objectAtIndex:index] floatValue]); return [[self.data objectAtIndex:index] floatValue]; }
Debug log:
12:51:55.054 App[5116:60b] numberOfBarsInBarChartView: 3 12:51:55.055 App[5116:60b] heightForBarViewAtAtIndex: 0, height: 20.000000 12:51:55.056 App[5116:60b] heightForBarViewAtAtIndex: 1, height: 30.000000 12:51:55.057 App[5116:60b] heightForBarViewAtAtIndex: 2, height: 50.000000
The text was updated successfully, but these errors were encountered:
Try setting the barChartView.minimumValue = 0.0f;
By default, the minimum value of a chart is set to the minimum value of the datasource's collection.
Sorry, something went wrong.
Got it! Thank you!
Can you please give suggestions to this issue.
#236
No branches or pull requests
I followed the tutorial and had a problem with bar height. Every time one bar has zero height (not showing in a view).
This is my code:
(void)viewDidLoad
{
[super viewDidLoad];
// data array
_data = @[@20, @30, @50];
JBBarChartView *barChartView = [[JBBarChartView alloc] init];
barChartView.delegate = self;
barChartView.dataSource = self;
barChartView.frame = CGRectMake(20, 120, 280, 200);
barChartView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
barChartView.layer.borderWidth = 1;
[self.view addSubview:barChartView];
[barChartView reloadData];
}
(NSUInteger)numberOfBarsInBarChartView:(JBBarChartView *)barChartView{
NSLog(@"numberOfBarsInBarChartView: %lu", (unsigned long)[self.data count]);
return [self.data count];
}
(CGFloat)barChartView:(JBBarChartView *)barChartView heightForBarViewAtAtIndex:(NSUInteger)index{
NSLog(@"heightForBarViewAtAtIndex: %lu, height: %f", index, [[self.data objectAtIndex:index] floatValue]);
return [[self.data objectAtIndex:index] floatValue];
}
Debug log:
12:51:55.054 App[5116:60b] numberOfBarsInBarChartView: 3
12:51:55.055 App[5116:60b] heightForBarViewAtAtIndex: 0, height: 20.000000
12:51:55.056 App[5116:60b] heightForBarViewAtAtIndex: 1, height: 30.000000
12:51:55.057 App[5116:60b] heightForBarViewAtAtIndex: 2, height: 50.000000
The text was updated successfully, but these errors were encountered: