GD::Graph problem
Mike Starke
plug-discuss@lists.plug.phoenix.az.us
Thu, 27 Mar 2003 13:25:25 -0500
In trying to generate a graph using GD::Graph
I keep getting the error:
Argument "AL AFC" isn't numeric in addition (+) at /usr/share/perl5/GD/Graph/pie.pm line 232.
I think this is a quoting issue, and here is why:
Below is the loop I use the create my array that
is used in the plot (@data). The loop works,
but GD's plot chokes on the data (error msg above).
while (my @ary = $sth->fetchrow_array()) {
push (@data, [@ary]);
}
Below is a handcrafted array using the first three rows
returned from my sql statement. This works.
#
#my @data = (['AL ADHC','AL AFC','AL CENTER-DI'],[30,12,119]);
I guess my question can be distilled down to this:
How can I create an array from a two column sql query
which has the 'format' as the one I handcrafted above?
Below is my line which creates thew graph.
print IMG $graph->plot(\@data)->png;
-Mike