# Gruff : label problem

**URL:** <https://www.ruby-forum.com/t/gruff-label-problem/177700>\
**Category:** Rails\
**Created:** [October 22, 2009, 8:15am UTC](https://www.ruby-forum.com/t/gruff-label-problem/177700 "2009-10-22T08:15:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahmet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ac91a4/32.png) [@ahmet](https://www.ruby-forum.com/u/ahmet)\
**Post date:** [October 22, 2009, 8:15am UTC](https://www.ruby-forum.com/t/gruff-label-problem/177700/1 "2009-10-22T08:15:13Z")

</div>

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.
