GD::Graph problem

トップ ページ
添付ファイル:
Eメールのメッセージ
+ (text/plain)
このメッセージを削除
このメッセージに返信
著者: Mike Starke
日付:  
新しいトピック: GD::Graph problem -> Fixed
題目: GD::Graph problem
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