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

Create Chart from data in Firebase db #800

Closed
tuzzo77 opened this issue Mar 4, 2016 · 2 comments
Closed

Create Chart from data in Firebase db #800

tuzzo77 opened this issue Mar 4, 2016 · 2 comments

Comments

@tuzzo77
Copy link

tuzzo77 commented Mar 4, 2016

Hi.

I'm trying to create a PieChart from my data stored in Firebase DB. My probem is that the legend contains only the first element of the array. If i put the example code in ViewDidLoad (without any observer) all works good. How can I refresh legend to be regenerated?

 firebase.observeEventType(.Value, withBlock: { snapshot in
            for item in snapshot.children {
......
            }
   self.setChart(self.answers, values: self.counts)
@pmairoldi
Copy link
Collaborator

  1. Make sure this change is happening on the main thread.
  2. Call notifyDataSetChanged to trigger rending of the chart for new data.

@tuzzo77
Copy link
Author

tuzzo77 commented Mar 4, 2016

notifyDataSetChanged solved!!! Thanks Sir :)

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