+ def plurality_pie
+ @election = Election.find(params[:id])
+ @election.results unless @election.plurality_result || @election.approval_result
+ votes = @election.votes.size
+ data = Hash.new
+ names = @election.names_by_id
+
+ @election.plurality_result.points.each do |candidate, votes|
+ data[names[candidate]] = votes
+ end
+
+ pie = GruffGraff.new ( :graph_type => Gruff::Pie,
+ :title => "Percentage of First Place Votes",
+ :data => data)
+ send_data(*pie.output)
+
+ end
+