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

Can't add graphs from storyboard #5

Closed
mschinis opened this issue Nov 11, 2014 · 2 comments
Closed

Can't add graphs from storyboard #5

mschinis opened this issue Nov 11, 2014 · 2 comments

Comments

@mschinis
Copy link

Hello,
I've been experimenting with your Swift files to create a graph on an existing UIView layer, but can't seem to get it to work.

I tried to adding the lines of the graph during viewWillLayoutSubviews, but I keep getting error on:

layer.strokeColor = colors[lineIndex].CGColor

in drawLine() in LineChart.swift file.

"fatal error: Cannot index empty buffer"

Is there any other way that I can plot graphs without having to initialise a LineChart instance manually?

@zemirco
Copy link
Owner

zemirco commented Nov 26, 2014

I don't use Storyboards.

Did you add a line via lineChart.addLine([3, 4, 9, 11, 13, 15]) ? Sounds like lineIndex is empty and cannot be used with colors array.

@mschinis
Copy link
Author

Yeap. I got it to work by creating a view, creating an IBOUTLET named "lineChartView" in my ViewController, and adding the linechart graph as a subview of "lineChartView".

To anyone else that has the same issue, you can see my implementation in this project:
https://github.com/mschinis/Swift-Playground

Thanks for this. I love it. Any plans for adding smoothLine or barCharts support?

@mschinis mschinis closed this as completed Dec 3, 2014
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

2 participants