[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

SVG::Graph

Mark

1/21/2005 10:04:00 AM

Guys I have tried SVG::Graph... my goodness, this is so great.
However I found a couple of strange things in the documentation.

1) The links to the sample are broken (for example: www.germane-
software/repositories/public/SVG/test/single.rb)

2) If I try the example:

require 'SVG/Graph/Pie'

fields = %w(Jan Feb Mar)
data_sales_02 = [12, 45, 21]

graph = SVG::Graph::Pie.new({
:height => 500,
:width => 300,
:fields => fields,
})

graph.add_data({
:data => data_sales_02,
:title => 'Sales 2002',
})

print "Content-type: image/svg+xml\r\n\r\n"
print graph.burn();


in this way: graph.rb > graph.svg
Then I get an error while loading the image at the first line. It
doesn't like the -print "Content-type: image/svg+xml\r\n\r\n"-.
Eliminating that line it works like a charm.

Could you please explain me why do I have to eliminate that line to
make it work?

Thanks,
TKMark

Inviato da www.mynewsgate.net
1 Answer

Tom Rathbone

1/21/2005 12:00:00 PM

0

Looks like the header from a HTTP transfer.. obviously this script was
intended to generate content for CGI. If you just want to create a
plain SVG file then you'll need to remove the http header.


On Fri, 21 Jan 2005 19:00:57 +0900, TKMark <8904invalid@mynewsgate.net> wrote:
> Guys I have tried SVG::Graph... my goodness, this is so great.
> However I found a couple of strange things in the documentation.
>
> 1) The links to the sample are broken (for example: www.germane-
> software/repositories/public/SVG/test/single.rb)
>
> 2) If I try the example:
>
> require 'SVG/Graph/Pie'
>
> fields = %w(Jan Feb Mar)
> data_sales_02 = [12, 45, 21]
>
> graph = SVG::Graph::Pie.new({
> :height => 500,
> :width => 300,
> :fields => fields,
> })
>
> graph.add_data({
> :data => data_sales_02,
> :title => 'Sales 2002',
> })
>
> print "Content-type: image/svg+xml\r\n\r\n"
> print graph.burn();
>
> in this way: graph.rb > graph.svg
> Then I get an error while loading the image at the first line. It
> doesn't like the -print "Content-type: image/svg+xml\r\n\r\n"-.
> Eliminating that line it works like a charm.
>
> Could you please explain me why do I have to eliminate that line to
> make it work?
>
> Thanks,
> TKMark
>
> Inviato da www.mynewsgate.net
>
>