Graphs with Gruff
Posted by Daniel Wanja
Mon, 20 Feb 2006 12:10:00 GMT
 |
class GraphController < BaseTimeController
def pages
g = Gruff::Pie.new("500x350")
g.title = "All Pages"
@current_user.pages.each do |page|
g.data(page.title, [page.total])
end
send_data(g.to_blob,
:disposition => 'inline',
:type => 'image/png',
:filename => "timers.png")
end
end
Pretty easy! Wasn’t it. Note the code above shows only the first of the graphs. Now if only I could find out how to set the minimum of the Bar chart to 0 instead of the minimum of the serie. Any help is appreciated?
|
How can I changed the pie label text size
Font sizes can be generaly changed as follows
However the PieChart has a fixed size for the marker_font_size. This is maybe the issue you have.
I haven’t checked if there was any change lately in the Gruff graph. If not then your are stuck with the predefined font size for the markers, unless you fix the Pie chart implementation.
Now if anyone knows better, please let me know.
Hope this helps.