--- loncom/xml/lonplot.pm 2001/12/21 20:06:25 1.15
+++ loncom/xml/lonplot.pm 2001/12/21 21:39:51 1.16
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Dynamic plot
#
-# $Id: lonplot.pm,v 1.15 2001/12/21 20:06:25 matthew Exp $
+# $Id: lonplot.pm,v 1.16 2001/12/21 21:39:51 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -87,7 +87,8 @@ my %plot_defaults =
transparent => {default => 'off', test => $onoff_test },
grid => {default => 'off', test => $onoff_test },
border => {default => 'on', test => $onoff_test },
- font => {default => 'medium', test => $sml_test }
+ font => {default => 'medium', test => $sml_test },
+ align => {default => 'left', test => $words_test }
);
my %key_defaults =
@@ -187,8 +188,11 @@ sub end_plot {
close($fh);
## return image tag for the plot
$result .= <<"ENDIMAGE";
-
+
ENDIMAGE
}
return $result;
@@ -360,7 +364,7 @@ sub start_data {
delete($curves[-1]->{'function'});
}
my $datatext = &Apache::lonxml::get_all_text("/data",$$parser[-1]);
- $datatext =~ s/\s+//g; # No whitespace, numbers must be seperated
+ $datatext =~ s/\s+/ /g; # No whitespace, numbers must be seperated
# by commas
if ($datatext !~ /^(([+-]?\d*\.?\d*)[, ]?)+$/) {
&Apache::lonxml::warning('Malformed data: '.$datatext);
@@ -369,7 +373,12 @@ sub start_data {
# Need to do some error checking on the @data array -
# make sure it's all numbers and make sure each array
# is of the same length.
- my @data = split /,/,$datatext;
+ my @data;
+ if ($datatext =~ /,/) {
+ @data = split /,/,$datatext;
+ } else { # Assume it's space seperated.
+ @data = split / /,$datatext;
+ }
for (my $i=0;$i<=$#data;$i++) {
# Check that it's non-empty
# Check that it's a number