--- loncom/xml/lonplot.pm 2012/02/13 11:24:16 1.154 +++ loncom/xml/lonplot.pm 2012/02/22 10:16:39 1.155 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Dynamic plot # -# $Id: lonplot.pm,v 1.154 2012/02/13 11:24:16 foxr Exp $ +# $Id: lonplot.pm,v 1.155 2012/02/22 10:16:39 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -624,7 +624,18 @@ sub start_gnuplot { } elsif ($target eq 'modified') { my $constructtag=&Apache::edit::get_new_args ($token,$parstack,$safeeval,keys(%gnuplot_defaults)); + if ($constructtag) { + # + # The color chooser does not prepent x to the color values + # Do that here: + # + foreach my $attribute ('bgcolor', 'fgcolor') { + my $value = $token->[2]{$attribute}; + if (defined $value && !($value =~ /^x/)) { + $token->[2]{$attribute} = 'x' . $value; + } + } $result = &Apache::edit::rebuild_tag($token); } } @@ -1355,6 +1366,13 @@ sub start_curve { my $constructtag=&Apache::edit::get_new_args ($token,$parstack,$safeeval,keys(%curve_defaults)); if ($constructtag) { + # + # Fix up the color attribute as jcolor does not prepend an x + # + my $value = $token->[2]{'color'}; + if (defined $value && !($value =~ /^x/)) { + $token->[2]{'color'} = 'x' . $value; + } $result = &Apache::edit::rebuild_tag($token); } } @@ -1501,7 +1519,17 @@ sub start_axis { } elsif ($target eq 'modified') { my $constructtag=&Apache::edit::get_new_args ($token,$parstack,$safeeval,keys(%axis_defaults)); + if ($constructtag) { + # + # Fix up the color attribute since jchooser does not + # prepend an x to the color: + # + my $value = $token->[2]{'color'}; + if (defined $value && !($value =~ /^x/)) { + $token->[2]{'color'} = 'x' . $value; + } + $result = &Apache::edit::rebuild_tag($token); } } @@ -1594,6 +1622,7 @@ sub write_gnuplot_file { $curve->{'color'} : $Apache::lonplot::plot{'fgcolor'} ); } + # set term if ($target eq 'web') { $gnuplot_input .= 'set terminal png enhanced nocrop ';