module MetricFu::GchartGrapher

Constants

COLORS
GCHART_GRAPH_SIZE
NUMBER_OF_TICKS

Public Instance Methods

determine_y_axis_scale(values) click to toggle source
# File lib/graphs/engines/gchart.rb, line 7
def determine_y_axis_scale(values)
  values.collect! {|val| val || 0.0 }
  if values.empty?
    @max_value = 10
    @yaxis = [0, 2, 4, 6, 8, 10]
  else
    @max_value = values.max + Integer(0.1 * values.max)
    portion_size = (@max_value / (NUMBER_OF_TICKS - 1).to_f).ceil
    @yaxis = []
    NUMBER_OF_TICKS.times {|n| @yaxis << Integer(portion_size * n) }
    @max_value = @yaxis.last
  end
end