# Graphs using ruport

**URL:** <https://www.ruby-forum.com/t/graphs-using-ruport/130324>\
**Category:** Ruby\
**Created:** [February 27, 2008, 11:34am UTC](https://www.ruby-forum.com/t/graphs-using-ruport/130324 "2008-02-27T11:34:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![seena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6de8d8/32.png) [@seena](https://www.ruby-forum.com/u/seena)\
**Post date:** [February 27, 2008, 11:34am UTC](https://www.ruby-forum.com/t/graphs-using-ruport/130324/1 "2008-02-27T11:34:51Z")

</div>

plz help!!!  
i am trying to create graphs using the ruport gem. even though it  
creates the graph “sales.png”. but it does not show it on the browser in  
the application.  
when i try to call it on the browser window it gives me an error saying  
“sorry something went wrong and it has been notified”

---

<div class="post-metadata">

**Author:** ![seena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6de8d8/32.png) [@seena](https://www.ruby-forum.com/u/seena)\
**Post date:** [February 27, 2008, 1:31pm UTC](https://www.ruby-forum.com/t/graphs-using-ruport/130324/2 "2008-02-27T13:31:57Z")

</div>

Seena N. wrote:

> plz help!!!  
> i am trying to create graphs using the ruport gem. even though it  
> creates the graph “sales.png”. but it does not show it on the browser in  
> the application.  
> when i try to call it on the browser window it gives me an error saying  
> “sorry something went wrong and it has been notified”

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

---

<div class="post-metadata">

**Author:** ![seena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6de8d8/32.png) [@seena](https://www.ruby-forum.com/u/seena)\
**Post date:** [February 27, 2008, 10:31pm UTC](https://www.ruby-forum.com/t/graphs-using-ruport/130324/3 "2008-02-27T22:31:41Z")

</div>

On Feb 27, 7:31 am, Seena N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> this is the code i had written:------ for the reference  
> Hi… can you please post this example code and the stack trace from  
> your Rails application to:

[http://list.rubyreports.org](http://list.rubyreports.org)

Over there, it may help benefit other users with the same problem.

Thanks,

-greg
