Gruff : label problem

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs