def terminal_report_hourly
    g = Gruff::Bar.new("600x300")
    g.theme_37signals
    g.title = "my graph"
    reports = TerminalHistory.find(:all, :conditions =>
["terminal_histories.created_at > ?", 1.hour.ago.to_s(:db)], :select =>
"terminal_code, hour(created_at), count(*) as total", :group =>
"terminal_code, hour(created_at)")
    reports.each {|report|
      g.data(report.terminal_code, [report.total.to_i])
    }
    g.labels = {0 => "12:00"}
    send_data(g.to_blob, :disposition => 'inline', :type => 'image/png',
:filename => "terminal_data_hourly.png")
  end

this is my coded  and I want to lists 24 hours as labels in a day depend
on my g.data results how can  I do it?

example result :label=> 11:00 total --> 30  label=> 16:00 total --> 20
label 20:00 total --> 10 and so on...
please help me.
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to