+ def choices_positions
+ @election = Election.find(params[:id])
+ pref_tally = make_preference_tally(@election)
+
+ fulldata = get_positions_info(@election)
+ (0...@election.candidates.size).each do |i|
+ sbar.data("Candidate#{i+1}", fulldata[i])
+ end
+
+ sbar = Gruff::Bar.new
+ sbar.title = "Times Voted in Each Position"
+ #sbar.theme = { :background_colors => ['#73BF26', '#ffffff'] }
+ sbar.font = File.expand_path('/usr/X11R6/lib/X11/fonts/TTF/Vera.ttf',
+ RAILS_ROOT)
+
+ graph = GruffGraff.new( :graph_type => Gruff::Bar,
+ :data_name => @election.name,
+ :data => data,
+ :interval_labels => labels,
+ :title => "Times Candidate Was Voted Each Position",
+ :x_axis_label => "Rank",
+ :y_axis_label => "Number of Times")
+
+
+
+
+ sbar.x_axis_label = "Rank"
+ sbar.y_axis_label = "Number of Times Ranked"
+
+ sbar.minimum_value = 0.0
+ send_data(sbar.to_blob, :disposition => 'inline', :type => 'image/png')
+
+
+ #data, labels = get_positions_info(@election)
+
+ end