#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    4
    Rep Power
    0
    I'm trying to create a graph with 'GD::Graph::lines'. To get the job done I need to fill a variable like this:

    @data = (
    [qw(09:00 09:05 09:10 09:15)],
    [ (1.0, 1.4, -0.9, -0.4)],
    );

    When I fill in these example-values in the perl-script itself, it works fine and a nice graph is created.

    However, my data are in a mysql-database, so I have to get them out of the database and into the variable '@data' in the required format (see above). One of the (many) things I tried, is to use a 'push' like this (in accordance with the PERLLOL(1)-manpage):

    while (@row = $sth->fetchrow_array) {
    push @data, $LoL["$time"][$value];
    }

    the $time and $value that are passed this way are:

    09:00 1.0
    09:05 1.4
    09:10 -0.9
    09:15 -0.4

    It doesn't work! The module reports:
    'Argument "09:00" isn't numeric in aelem at sample.pl line 40'. I think the variables are not passed into '@data' in the right order.

    Can anyone tell me how I can fetch the data into the variable '@data' as required by the 'GD::Graph::lines'-module?

    Thnx in advance...
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Location
    Alkmaar, The Netherlands
    Posts
    123
    Rep Power
    15
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>It doesn't work! The module reports:
    'Argument "09:00" isn't numeric in aelem at sample.pl line 40'.
    [/quote]

    I've got to questions:

    1. Could it be that 09:00 is a date/time value and needs to be parsed to a numeric value?

    2. Could it be that 09:00 is regarded as a string in stead of a numeric value?

    These are just 2 slips of my mind.

    ------------------
    Good luck,
    Bas

    ------------------
    E-mail me at: b.vandermeijden@pecoma.nl

IMN logo majestic logo threadwatch logo seochat tools logo