Add charts for popular attendees/suggestions
This commit is contained in:
23
js/components/PopularSuggestionsChart.js
Normal file
23
js/components/PopularSuggestionsChart.js
Normal file
@ -0,0 +1,23 @@
|
||||
var React = require('react');
|
||||
|
||||
var BarChart = require('../components/BarChart');
|
||||
|
||||
module.exports = React.createClass({
|
||||
displayName: "PopularSuggestionsChart",
|
||||
render: function() {
|
||||
var data = [];
|
||||
for (var i = 0; i < this.props.popularSuggestions.length; i++) {
|
||||
var suggestion = this.props.popularSuggestions[i];
|
||||
data.push({
|
||||
'label': suggestion.RestaurantName,
|
||||
'value': suggestion.Popularity
|
||||
});
|
||||
}
|
||||
|
||||
data.sort(function(a, b){return b.value - a.value;});
|
||||
|
||||
return (
|
||||
<BarChart title="Suggestion Frequency" data={data}/>
|
||||
);
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user