Marston A.
2006-Jul-05 12:14 UTC
[Rails] Need some Gruff graphing help - custom dimensions?
I''ve been working with Gruff to do all my apps graphing and such etc. I love it but I''m just having a hard time customizing the graphs, but this is perhaps due to my inability to comprehend the online RDocs. What I want to do is adjust the width / heights of my graphs or at the VERY LEAST the heights. It seems that if you scale a graph anywhere below 400-450px it is pretty much unreadable, which is very unfortunate since I''ve seen so many very nice, small-scale graphs around online (such as in web stat packages etc). So the next best thing I think I could do help fit into my layout is atleast make my graph wide-screen so-to-speak and not as tall as the default height. I''ve been searching the docs and I''ve seen many methods that regard setting height but every attempts I''ve made to implement in my code results in errors. On the topfunky sample side there is a "wide graph" example which is basically just wide and not as tall, it is the second example here: http://geoffreygrosenbach.com/projects/show/5 How do I do that when working with similar but very simple line graphs? Given this sample code below, how would I easily modify the height/width or make it a widegraph as in the example above? Thanks for any help. data = [1, 2, 3, 4, 5, 6] g = Gruff::Line.new(500) #Sets scale to 500px, but I''d like 500 width and 300 height g.title = "Samplegraph" g.labels = {1 => "Today", 3 => "Yesterday", 6 => "The Day Before"} g.theme_37signals g.data("Graph", data, ''#378CDF'') g.maximum_value = 10 send_data(g.to_blob, :disposition => ''inline'', :type => ''image/png'', :filename => "sample_graph.png -- Posted via http://www.ruby-forum.com/.
Franco Sellitto
2009-Feb-04 15:52 UTC
Re: Need some Gruff graphing help - custom dimensions?
> g = Gruff::Line.new(500) #Sets scale to 500px, but I''d like 500 width > and 300 heightg = Gruff::Line.new("500x300") -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---