Closed mphan6 closed 4 months ago
@mphan6 Just took a look at the PR, looks awesome! Looks like it's really close to being done as well.
Wanted to mention something from your comment in the issue; I don't think you should have to make a call to the github api tbh. Just turn your state data field into a prop so that the user can import data into the component through that instead. Data from the github api will need to be formatted a certain way to be accepted by the pie chart for sure, but this formatting should be done outside the component.
Beyond that you might want names associated with each data point (however we can do this in a spearate issue/PR, you don't have to do it for now, just do this if you actually feel like it/have time). To do this you might want to turn data into an array of objects instead of an array of integers. So instead of having:
data: [5,12,8]
You'd have:
data: [
{'name': 'Object1', 'value': 5},
{'name': 'Object2', 'value': 12},
{'name': 'Object3', 'value': 8}
]
I'll be online in the class slack, if you have any questions from this you can DM me there.
Ahhh - I didn't see this. I took a break and started playing with the LanguageList page, but yeah I am starting to get it to work with an Array of Objects.
What I forgot about were the labels that will use the object names so I need to create the legend to associate it with the pie slices and it should work.
Any further suggestions would be great (: !
Issue: #28 Attempting to add functionality for Pie Chart.
Currently have static/hard coded data being displayed within a pie.
Added Legend for the PieChart and allowed for use in other modules so long as an array of objects is passed to the data parameter with names and counts to be graphed: