hi, cud anybody plz tell how to veiw or show a graph that has been created using the ruport gem....... i have created the graph n report refering "http://ruportbook.com/introducing_ruport.html"\. but at the end it is not showing the graph on the browser.
Seena Nair wrote:
hi, cud anybody plz tell how to veiw or show a graph that has been created using the ruport gem....... i have created the graph n report refering "http://ruportbook.com/introducing_ruport.html"\. but at the end it is not showing the graph on the browser.
the code:
this is the code i had written:------ for the reference
require 'rubygems' require 'ruport' require 'ruport/util'
class GraphReportController < Ruport::Report
renders_as_graph
def renderable_data(format)
graph = Graph(%w[a b c d e]) graph.series [1,2,3,4,5], "foo" graph.series [11,22,70,2,19], "bar" draw_graph(graph, :title => "Graph", :labels =>"Label") # send_data(graph.to_blob, :disposition => 'inline', :type => 'image/png', :filename => "foo.png") return graph end
end
GraphReportController.generate do |r| r.as(:png, :title => "My Graph", :labels => {0 => '2003', 2 => '2004', 4 => '2005'}, :file => "my_graph.png" ) end
This looks like something I can do. After much installation I try this simple example and get the following error. I did find a simple example that creates a pdf file, but I'd really like to make a graph. Any ideas on what I have misconfigured?
This is on an iMac G5 with 3g of memory and lots of disk space.
/Library/Ruby/Gems/1.8/gems/ruport-util-0.13.0/lib/ruport/util/report.rb:117:in `method_missing': undefined method `draw_graph' for #<GraphReportController:0x13e3dd8> (NoMethodError) from g2.rb:10:in `renderable_data' from /Library/Ruby/Gems/1.8/gems/ruport-1.4.0/lib/ruport/renderer.rb:175:in `old_as' from /Library/Ruby/Gems/1.8/gems/ruport-1.4.0/lib/ruport/renderer.rb:336:in `render' from /Library/Ruby/Gems/1.8/gems/ruport-1.4.0/lib/ruport/renderer.rb:379:in `build' from /Library/Ruby/Gems/1.8/gems/ruport-1.4.0/lib/ruport/renderer.rb:335:in `render' from /Library/Ruby/Gems/1.8/gems/ruport-1.4.0/lib/ruport/renderer.rb:172:in `old_as' from /Library/Ruby/Gems/1.8/gems/ruport-util-0.13.0/lib/ruport/util/report.rb:95:in `as' from g2.rb:17 from /Library/Ruby/Gems/1.8/gems/ruport-util-0.13.0/lib/ruport/util/report.rb:126:in `generate' from g2.rb:16