Module: Bodhi::Helpers

Defined in:
lib/bodhi/helpers/bodhi_helpers.rb

Instance Method Summary collapse

Instance Method Details

#chart_for(*args) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/bodhi/helpers/bodhi_helpers.rb', line 3

def chart_for(*args)
  options = args.extract_options!
  
  metric = Bodhi::Metric[args[0]]
  start_date = options[:start] || 1.month.ago
  end_date = options[:end] || Time.now
  width = options[:width] || "500px"
  height = options[:height] || "200px"

  chart_tag(metric, start_date, end_date, {:width => width, :height => height}).html_safe
end