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

[Question][LineChart][FlSpot] How can I print x and y values of FlSpots? #469

Closed
LondonTran opened this issue Oct 15, 2020 · 2 comments · Fixed by #470
Closed

[Question][LineChart][FlSpot] How can I print x and y values of FlSpots? #469

LondonTran opened this issue Oct 15, 2020 · 2 comments · Fixed by #470
Labels
Fundamental question Further information is requested

Comments

@LondonTran
Copy link
Contributor

LondonTran commented Oct 15, 2020

I would like to know how to print the x and y values for FlSpots from a List of FlSpots.
Iman posted an answer at this link:
https://stackoverflow.com/questions/60281061/how-to-assign-an-array-to-spots-in-fl-chart-in-flutter/61987521#61987521

When I try to print the FlSpot values from the answer Iman gave with "print(spots)", my console returns:
I/flutter (19814): [FlSpot, FlSpot, FlSpot, FlSpot, FlSpot, FlSpot, FlSpot]

How can I instead receive the x and y coordinates of each FlSpot and not just the data type? It would be helpful to know how to do this so I can double-check my FlSpot values in the Console during testing.

@imaNNeo
Copy link
Owner

imaNNeo commented Oct 16, 2020

Got it.
Each Dart object has a toString method that you can override.
If you don't override it, dart uses a default implementation (that prints the data type). Otherwise, it prints what you define in your overridden method.
Now I suggest you read about it. Then you can fork this repo and make the change. Then create your PullRequest and I will merge it to the master.
Also, I encourage you to attend to the Hacktoberfest and they count your PullRequest to gift a swag to you.
Thanks!

@imaNNeo imaNNeo closed this as completed Oct 16, 2020
@imaNNeo imaNNeo added Fundamental question Further information is requested labels Oct 16, 2020
@LondonTran
Copy link
Contributor Author

Thank you for your response! I will research that to learn more about it and make the change 👍
Oh I didn't know about Hacktoberfest but I looked it up and it looks really exciting, I just signed up! This will be my first time contributing to open source. I'll create a pull request soon, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fundamental question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants