projects
/
selectricity
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Finished organzing preferential vote tables into one partial. Also changed RubyVote...
[selectricity]
/
app
/
controllers
/
graph_controller.rb
diff --git
a/app/controllers/graph_controller.rb
b/app/controllers/graph_controller.rb
index 442bb65db975b9e4b650bd18815b560561595277..c72da85a6dea19732d070710ff42fb330fbc2c1a 100644
(file)
--- a/
app/controllers/graph_controller.rb
+++ b/
app/controllers/graph_controller.rb
@@
-99,6
+99,7
@@
class GraphController < ApplicationController
legend = Hash.new
alldata, labels = get_positions_info(@election)
@election.results unless @election.condorcet_result || @election.ssd_result
legend = Hash.new
alldata, labels = get_positions_info(@election)
@election.results unless @election.condorcet_result || @election.ssd_result
+ ranked_candidates = @election.condorcet_result.ranked_candidates.flatten
names = Hash.new
candidates = @election.candidates.sort.collect {|candidate| candidate.id}
names = Hash.new
candidates = @election.candidates.sort.collect {|candidate| candidate.id}
@@
-106,7
+107,6
@@
class GraphController < ApplicationController
names[candidate]= (Candidate.find(candidate)).name
end
names[candidate]= (Candidate.find(candidate)).name
end
- ranked_candidates = @election.condorcet_result.ranked_candidates.flatten
ranked_candidates.each_with_index \
{|candidate, index| legend[names[candidate]] = alldata[index]}
ranked_candidates.each_with_index \
{|candidate, index| legend[names[candidate]] = alldata[index]}
@@
-119,6
+119,15
@@
class GraphController < ApplicationController
send_data(*graph.output)
end
send_data(*graph.output)
end
+ def plurality_pie
+ @election = Election.find(params[:id])
+
+
+
+ pie = GruffGraff.new ( :graph_type => Gruff::Pie,
+ :data => ,
+ :title => "Percentage of First Plce Votes")
+
private
def get_positions_info(election)
buckets = Hash.new
private
def get_positions_info(election)
buckets = Hash.new
Benjamin Mako Hill
||
Want to submit a patch?