version 1.32, 2003/12/18 16:33:02
|
version 1.35, 2005/05/25 22:31:51
|
Line 59 use GD::Graph::bars;
|
Line 59 use GD::Graph::bars;
|
use GD::Graph::lines; |
use GD::Graph::lines; |
use GD::Graph::colour; |
use GD::Graph::colour; |
use GD::Graph::Data; |
use GD::Graph::Data; |
use LONCAPA::loncgi(); |
use LONCAPA::loncgi; |
|
|
sub unescape { |
sub unescape { |
my $str=shift; |
my $str=shift; |
Line 92 my $id = $ENV{'QUERY_STRING'};
|
Line 92 my $id = $ENV{'QUERY_STRING'};
|
# usage: &get_env($name,$default) |
# usage: &get_env($name,$default) |
sub get_env { |
sub get_env { |
my $key = 'cgi.'.$id.'.'.(shift()); |
my $key = 'cgi.'.$id.'.'.(shift()); |
return shift if (! exists($ENV{$key})); |
return shift if (! exists($Apache::lonnet::env{$key})); |
return $ENV{$key}; |
return $Apache::lonnet::env{$key}; |
} |
} |
|
|
if (! &LONCAPA::loncgi::check_cookie_and_load_env()) { |
if (! &LONCAPA::loncgi::check_cookie_and_load_env()) { |
Line 198 if (! defined($MyGraph)) {
|
Line 198 if (! defined($MyGraph)) {
|
## |
## |
## Build the @Data array |
## Build the @Data array |
my $NumSets = &get_env('NumSets'); |
my $NumSets = &get_env('NumSets'); |
my @Data; # stores the data for the graph |
my @Data; # stores the data for the graph |
|
my @Legend; # one entry per data set |
my @xlabels = split(',',&get_env('labels')); |
my @xlabels = split(',',&get_env('labels')); |
push(@Data,\@xlabels); |
push(@Data,\@xlabels); |
for (my $i=1;$i<=$NumSets;$i++) { |
for (my $i=1;$i<=$NumSets;$i++) { |
push(@Data,[split(',',&get_env('data.'.$i))]); |
push(@Data,[split(',',&get_env('data.'.$i))]); |
|
push(@Legend,&get_env('data.'.$i.'.label',undef)); |
} |
} |
|
|
my $error = ''; |
my $error = ''; |
Line 211 if (! $MyGraph->set(%GraphSettings)) {
|
Line 213 if (! $MyGraph->set(%GraphSettings)) {
|
return; |
return; |
} |
} |
|
|
|
if (join('',@Legend) ne '') { |
|
$MyGraph->set_legend(@Legend); |
|
} |
|
|
|
|
my $plot = $MyGraph->plot(\@Data); |
my $plot = $MyGraph->plot(\@Data); |
if (! defined($plot)) { |
if (! defined($plot)) { |
my $error = 'Unable to plot the data provided.'; |
my $error = 'Unable to plot the data provided.'; |