-
Notifications
You must be signed in to change notification settings - Fork 2
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
Added graphs for individual events #41
Open
alexanderqchen
wants to merge
13
commits into
master
Choose a base branch
from
alex/individual-event-graphs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
3dee0ee
added charts for individual event with hard-coded data
alexanderqchen bf628f2
commit to switch branches
alexanderqchen 136051a
embeded graphs within an event component
alexanderqchen d61e059
merged with master
alexanderqchen 4d44c64
changed spaces to tabs
alexanderqchen 6dbdf22
made bar graphs vertical and added total attendees
alexanderqchen f47b3ed
improved attendees display format, accounted for long event names, an…
alexanderqchen 5cda655
removed debug console.log
alexanderqchen 89ee34e
added major consolidation function
alexanderqchen 24fbb5b
Merge branch 'alex/individual-event-graphs' of https://github.com/ucl…
alexanderqchen cce94af
Merge branch 'master' into alex/individual-event-graphs
alexanderqchen 876adde
completed changes that nikhil requested
alexanderqchen b876320
removed event components from controlPanel
alexanderqchen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react' | ||
import EventAnalytics from './eventAnalytics' | ||
import Config from 'config' | ||
import { translate } from 'utils' | ||
|
||
export default class EventCard extends React.Component { | ||
|
||
render() { | ||
const yearData = { 1: 100, 2: 50, 3: 25, 4: 10, 5: 3 }; | ||
const majorData= { "CS/CSE": 300, "Ling CS": 100, "Math": 25 }; | ||
|
||
return( | ||
<div className="event-card user-card"> | ||
<div className="content"> | ||
<h2>Event Title</h2> | ||
<h3>Event Committee</h3> | ||
|
||
<div className="points-container"> | ||
<div className="points Headline-2Secondary">100</div> | ||
<div className="label SubheaderSecondary">attendees</div> | ||
</div> | ||
|
||
<div className="subcontent"> | ||
<span className="time">7:00 am — 11:00 am</span> | ||
<p className="location">Event Location</p> | ||
</div> | ||
|
||
<EventAnalytics yearData={yearData} majorData={majorData} /> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React from 'react'; | ||
import Button from 'components/Button'; | ||
import Event from './event.js'; | ||
import { Chart } from 'chart.js' | ||
import { Bar } from 'react-chartjs-2' | ||
|
||
|
||
|
||
export default class EventAnalytics extends React.Component { | ||
|
||
render() { | ||
const yearData = { | ||
labels: ["1", "2", "3", "4", "5+"], | ||
datasets: [{ | ||
label: 'Attendees', | ||
data: Object.values(this.props.yearData), | ||
backgroundColor: [ | ||
'rgba(255, 99, 132, 0.2)', | ||
'rgba(255, 159, 64, 0.2)', | ||
'rgba(255, 206, 86, 0.2)', | ||
'rgba(75, 192, 192, 0.2)', | ||
'rgba(54, 162, 235, 0.2)' | ||
], | ||
borderColor: [ | ||
'rgba(255,99,132,1)', | ||
'rgba(255, 159, 64, 1)', | ||
'rgba(255, 206, 86, 1)', | ||
'rgba(75, 192, 192, 1)', | ||
'rgba(54, 162, 235, 1)' | ||
], | ||
borderWidth: 1 | ||
}], | ||
options: { | ||
legend: { | ||
display: false | ||
} | ||
} | ||
}; | ||
|
||
const majorData = { | ||
labels: Object.keys(this.props.majorData), | ||
datasets: [{ | ||
label: 'Attendees', | ||
data: Object.values(this.props.majorData), | ||
backgroundColor: [ | ||
'rgba(255, 99, 132, 0.2)', | ||
'rgba(75, 192, 192, 0.2)', | ||
'rgba(54, 162, 235, 0.2)' | ||
], | ||
borderColor: [ | ||
'rgba(255,99,132,1)', | ||
'rgba(75, 192, 192, 1)', | ||
'rgba(54, 162, 235, 1)' | ||
], | ||
borderWidth: 1 | ||
}] | ||
}; | ||
|
||
return ( | ||
<div className="chartWrapper"> | ||
<h3 className="chart-title">Attendees By Year</h3> | ||
<Bar data={yearData} options={{legend: { display: false }}} /> | ||
<h3 className="chart-title">Attendees By Major</h3> | ||
<Bar data={majorData} options={{legend: { display: false }}} /> | ||
</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,4 +83,4 @@ export default class Leaderboard extends React.Component { | |
); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change this component to take in the data and labels through props instead of hard coding.
For example, you might pass in:
And then use the passed in objects to derive the labels, data, and display them.