Dan Webb
3/11/2009 9:17:00 AM
Hi again,
As suggested I've changed tact. It now looks like gruff doesn't like the
array created by FasterCSV, but I don't know why!
If I create an array manually then feed it into gruff, i.e.=20
a =3D [1,2,3,4,5]
g.data("X", a)
it works absolutely fine. However if I've put the same data into a csv
file, then read it in using either:=20
a =3D fastercsv.read("r.csv")
or=20
FasterCSV.foreach("r.csv") do |row|=20
a << row
end
If I puts all three they all print out as
1
2
3
4
5
And both errors given by the array when I use fasterCSV are:
c:/ruby/lib/ruby/gems/1.8/gems/gruff-0.3.4/lib/gruff/base.rb:943:in
`larger_than
_max?': undefined method `>' for ["1", "2", "3", "4", "5"]:Array
(NoMethodError)
from
c:/ruby/lib/ruby/gems/1.8/gems/gruff-0.3.4/lib/gruff/base.rb:453:in
`data'
from
c:/ruby/lib/ruby/gems/1.8/gems/fastercsv-1.4.0/lib/faster_csv.rb:15
70:in `each_with_index'
from
c:/ruby/lib/ruby/gems/1.8/gems/gruff-0.3.4/lib/gruff/base.rb:443:in
`each'
from
c:/ruby/lib/ruby/gems/1.8/gems/gruff-0.3.4/lib/gruff/base.rb:443:in
`each_with_index'
from
c:/ruby/lib/ruby/gems/1.8/gems/gruff-0.3.4/lib/gruff/base.rb:443:in
`data'
from main.rb:27
am I missing something spectacular?
Thanks,
Dan
-----Original Message-----
From: James Gray [mailto:james@grayproductions.net]=20
Sent: 10 March 2009 15:06
To: ruby-talk ML
Subject: Re: FasterCSV, Gruff and Large Data Import
On Mar 10, 2009, at 9:57 AM, Dan Webb [dbw] wrote:
> On a second look the error I'm getting is a gruff related one.
>
> c:/ruby/lib/ruby/gems/1.8/gems/gruff-0.3.4/lib/gruff/base.rb:943:in
> `larger_than
> _max?': undefined method `>' for ["1\t8877"]:Array (NoMethodError)
> from
Gruff expects an Array of values to graph. It looks like you might be =20
feeding it an Array of Arrays and even those values look fishy.
I recommend simplifying the problem. First, try just reading the =20
first five lines of your data file and graphing just that.
When you have that working, you can expand the data and see how things =20
go.
James Edward Gray II