A
alexjaquet
Hi,
I want to use use GD::Graph:ie; to generate some graph from db datas.
But I don't know how to work with the array for the graph
here a sample code I use to collect my db datas:
local our ($c)= sqlSelectMany("DISTINCT(id_recherche),
nom,ref_categorie,nbr","recherche,a_recherche"," ref_recherche =
id_recherche $where ORDER BY nbr DESC LIMIT 0,$nbr_show");
while( ($SEARCH{'nom'},$SEARCH'nbr'})=$c->fetchrow()) {
$array[ $i -1 ] = "$SEARCH{'nom'}";
$array[ $j -1 ] = "$SEARCH{'nbr'}";
}
How to put it into the data array used for the graph :
local our @data = (
[ qw( 1st 2nd 3th 4th 5th 6th 7th 8h 9th 10th) ],
[ sort { $b <=> $a} (5.6, 7.1, 3.03, 4.05, 1.34, 0.2, 2.56, 2.56,
2.56, 2.56) ]
);
local our $my_graph = new GD::Graph:ie( 300, 300 );
#more code not usefull for the question
$my_graph->plot(\@data);
Thanks
I want to use use GD::Graph:ie; to generate some graph from db datas.
But I don't know how to work with the array for the graph
here a sample code I use to collect my db datas:
local our ($c)= sqlSelectMany("DISTINCT(id_recherche),
nom,ref_categorie,nbr","recherche,a_recherche"," ref_recherche =
id_recherche $where ORDER BY nbr DESC LIMIT 0,$nbr_show");
while( ($SEARCH{'nom'},$SEARCH'nbr'})=$c->fetchrow()) {
$array[ $i -1 ] = "$SEARCH{'nom'}";
$array[ $j -1 ] = "$SEARCH{'nbr'}";
}
How to put it into the data array used for the graph :
local our @data = (
[ qw( 1st 2nd 3th 4th 5th 6th 7th 8h 9th 10th) ],
[ sort { $b <=> $a} (5.6, 7.1, 3.03, 4.05, 1.34, 0.2, 2.56, 2.56,
2.56, 2.56) ]
);
local our $my_graph = new GD::Graph:ie( 300, 300 );
#more code not usefull for the question
$my_graph->plot(\@data);
Thanks