[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: ruby SVG::Graph module problem.

Williams, Chris

4/18/2005 3:17:00 PM

Simon,

> #======Code==========
> #!/usr/bin/ruby
> require 'SVG/Graph/TimeSeries'
> # Data sets are x,y pairs
> data1 = ["17/6/72", 11, "11/1/72", 7, "13/4/04 17:31", 11, "11/9/01",
9,
> "11/9/85", 2, "1/9/88", 1, "15/1/95", 13]
> data2 = ["1/8/73", 18, "1/2/77", 15, "1/10/98", 4, "1/5/02", 14,
> "1/3/95", 6, "1/8/91", 12, "1/12/87", 6, "1/5/84", 17, "1/10/80", 12]
> title = "This is the title"
> graph = SVG::Graph::TimeSeries.new( {
> :width => 640,
> :height => 480,
> :graph_title => title,
> :show_graph_title => true,
> :no_css => true,
> :key => true,
> :scale_x_integers => true,
> :scale_y_integers => true,
> :min_x_value => 0,
> :min_y_value => 0,

.. snip ..

> #========output============
> c:/ruby/lib/ruby/1.8/date/format.rb:236:in `dup': can't dup Fixnum
> (TypeError)
> from c:/ruby/lib/ruby/1.8/date/format.rb:236:in `_parse'
> from c:/ruby/lib/ruby/1.8/parsedate.rb:9:in `parsedate'
> from
> c:/ruby/lib/ruby/site_ruby/1.8/SVG/Graph/TimeSeries.rb:176:in
> `min_x_value='

If you look, SVG is choking on the min_x_value. It looks like it expects
a date string in the format you use in your data set, not a Fixnum of 0
as you have set it.

Try entering the start date as a string for the value and see if that
fixes it.

Thanks,
Chris