-
Notifications
You must be signed in to change notification settings - Fork 420
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
Following the tutorial creates an empty/blank view #16
Comments
Did you set the datasource and delegate? Add the barChartView as a subview? Check out the demo project for a complete example. |
Yes, followed the tutorial completely - the graph works only when initialized with
Used the following mock delegate functions:
|
Try this.
|
It is recommended that you initialize any JB* chart view with initWithFrame:... even if it is with CGRectZero. As well, you need to supply each bar with a height (random or otherwise) as suggested by @yeahdongcn. |
@yeahdongcn I tried with the random bar chart heights, but the resulting view is still empty. @terryworona If the library is not going to work with the empty initializers, should we update the tutorial? Thanks for the support guys! |
@zkhalapyan I added default init functions for both line and bar charts. You can now initialize JBLineChartView and JBBarChartView with init as well as initWithFrame:. Note: you must set a frame if you start supplying headers and footers, otherwise an assert will catch the mis-matched layout constraints. I also updated the (demo) line & bar chart controllers to use base -init to demonstrate the change. Hope this helps. |
This code works for me. |
In view did load for my view controller have the following : Nothing loads in the view and the delegate/datasource methods don't get called... |
@simonbromberg you have to call reloadData to invoke the drawing. |
Ah, thanks, that fixed it. I know it's kind of implied, since you're following the UITableView structure, but you should consider mentioning that in the readme. Another Now I have: (in viewDidLoad)
|
Trying initializing the chartView with the container's bounds?
|
Thanks, that fixed it. |
it gives me a blankbar on the last one, for example i set number of bar 4 then it will display 3 with a single large space for the fourth one here is the code
-(CGFloat)barChartView:(JBBarChartView *)barChartView heightForBarViewAtIndex:(NSUInteger)index
}
thanks |
@ridzkurniawan try setting the chart's minimumValue to 0. |
@terryworona Thanks, it works now |
How can I set the label of a bar? |
@MVakas the bar's do not have labels (by default); the demo project uses a footer subview to label each bar. You can create your own custom bar views via:
From there, you can place your own label on a bar and manage it yourself. |
I followed the tutorial to create the bar chart, and the result was an empty screen. I am assuming the problem is in the initialization code:
Can someone double check this and see if they can reproduce the issue on an empty project?
The text was updated successfully, but these errors were encountered: