--- loncom/homework/functionplotresponse.pm 2011/04/04 15:44:37 1.58
+++ loncom/homework/functionplotresponse.pm 2011/05/11 21:17:59 1.62
@@ -1,7 +1,7 @@
# LearningOnline Network with CAPA
# option list style responses
#
-# $Id: functionplotresponse.pm,v 1.58 2011/04/04 15:44:37 www Exp $
+# $Id: functionplotresponse.pm,v 1.62 2011/05/11 21:17:59 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -74,8 +74,8 @@ sub geogebra_default_parameters {
-
-
+
+
@@ -380,7 +380,21 @@ sub answer_spline_script {
if ($order<2) { $order=2; }
if ($order>8) { $order=8; }
$Apache::functionplotresponse::counter++;
- my $label='C'.$Apache::functionplotresponse::counter;
+ my $label='CSpline'.$Apache::functionplotresponse::counter;
+ my $output='document.ggbApplet_'.$id.'.evalCommand("'.$label.'=Spline'.$order.'[';
+ for (my $i=0;$i<=$#points;$i+=4) {
+ $output.="($points[$i],$points[$i+1]),($points[$i+2],$points[$i+3]),";
+ }
+ $output=~s/\,$//;
+ $output.=']");'."\n";
+ for (my $i=2; $i<2*$order; $i+=2) {
+ $output.='document.ggbApplet_'.$id.'.setColor("'.$label.'_'.($i>=10?'{':'').$i.($i>=10?'}':'').'",0,170,0);'."\n";
+ }
+ for (my $i=1; $i<2*$order; $i+=2) {
+ $output.='document.ggbApplet_'.$id.'.setVisible("'.$label.'_'.($i>=10?'{':'').$i.($i>=10?'}':'').'",false);'."\n";
+ }
+
+ return $output;
}
#
@@ -1246,7 +1260,7 @@ sub end_functionplotelements {
$result.=&plot_script($internalid,$func,1,'','00aa00',$xl,$xh,6);
} else {
# This is a spline
- $result.=&answer_spline_script(@components);
+ $result.=&answer_spline_script($internalid,@components);
}
}
}