deepanjali19 / GitHub-Dashboard

A web based GitHub Dashboard for Seneca students working on Open Source Development.
MIT License
3 stars 9 forks source link

Issue 28 [Completed] #38

Closed mphan6 closed 4 months ago

mphan6 commented 5 years ago

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:

// Info to be graphed
info = [
   {'name': '', 'count': 0},
   {'name': '', 'count': 0}
]
// Element to be rendered
<PieChart data={info}/>
jkmdev commented 5 years 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.

mphan6 commented 5 years ago

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 (: !