X-Git-Url: https://projects.mako.cc/source/selectricity-live/blobdiff_plain/1fcd2d064dfef0dff9b07a40d0f5d30e662d1d86..500f98b7b7c16d3b75ee85ef1cd7bc9180f3a533:/app/controllers/graph_controller.rb?ds=sidebyside diff --git a/app/controllers/graph_controller.rb b/app/controllers/graph_controller.rb index 69577c6..b80b5d3 100644 --- a/app/controllers/graph_controller.rb +++ b/app/controllers/graph_controller.rb @@ -3,11 +3,13 @@ class GraphController < ApplicationController class GruffGraff def initialize(options) - size = "700x400" + size = options[:size] ? options[:size] : "400x300" #allow custom sizing @graph = options[:graph_type].new(size) - - @graph.theme = { :colors => ['#000000', '#00FFFF', '#FFCC00', '#990033'], - :background_colors => ['#74ce00', '#ffffff'] } + + @graph.no_data_message = "No Voters" + + @graph.theme = { :colors => ['#005CD9', '#DC0D13', '#131313', '#990033'], + :background_colors => ['#74CE00', '#FFFFFF'] } @graph.font = File.expand_path('/usr/X11R6/lib/X11/fonts/TTF/Vera.ttf', RAILS_ROOT) @@ -72,6 +74,7 @@ class GraphController < ApplicationController :data => data, :interval_labels => labels, :title => "Voters Over Time", + :size => "270x230", :x_axis_label => scale, :y_axis_label => "Number of Votes") send_data(*graph.output) @@ -130,7 +133,7 @@ class GraphController < ApplicationController data[names[candidate]] = votes end - pie = GruffGraff.new ( :graph_type => Gruff::Pie, + pie = GruffGraff.new( :graph_type => Gruff::Pie, :title => "Percentage of First Place Votes", :data => data) send_data(*pie.output)