--- loncom/homework/functionplotresponse.pm 2011/10/13 01:54:12 1.65
+++ loncom/homework/functionplotresponse.pm 2011/11/18 19:32:48 1.74
@@ -1,7 +1,7 @@
# LearningOnline Network with CAPA
-# option list style responses
+# Functionplot responses
#
-# $Id: functionplotresponse.pm,v 1.65 2011/10/13 01:54:12 www Exp $
+# $Id: functionplotresponse.pm,v 1.74 2011/11/18 19:32:48 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -35,6 +35,7 @@ use Apache::run;
BEGIN {
&Apache::lonxml::register('Apache::functionplotresponse',('functionplotresponse','backgroundplot','spline',
+ 'plotobject','plotvector',
'functionplotrule','functionplotruleset',
'functionplotelements'));
}
@@ -76,7 +77,7 @@ sub geogebra_default_parameters {
-
+
@@ -164,6 +165,14 @@ sub update_register {
sub set_point_coordinate {
my ($id,$variable,$x,$y,$fixed)=@_;
my $mult=($fixed?'a*':'');
+# Get rid of wild exponents, make sure it's a number
+ $x=1.*$x;
+ $y=1.*$y;
+# GeoGebra does not understand "E"
+ $x=~s/[e|E]/\*10\^/;
+ $x=~s/\+//;
+ $y=~s/[e|E]/\*10\^/;
+ $y=~s/\+//;
return (<
#
@@ -973,6 +1130,7 @@ sub compare_rel {
sub addlog {
my ($text)=@_;
+ $text=~s/\'/\\\'/g;
$Apache::functionplotresponse::ruleslog.=$text.'
';
}
@@ -981,6 +1139,13 @@ sub actualval {
return $xmin+$i/400.*($xmax-$xmin);
}
+sub fpr_val {
+ my ($arg)=@_;
+ return &actualval($Apache::functionplotresponse::functionplotrulelabels{$arg},
+ $Apache::functionplotresponse::fpr_xmin,
+ $Apache::functionplotresponse::fpr_xmax);
+}
+
sub fpr_f {
my ($arg)=@_;
return $Apache::functionplotresponse::func[&array_index($Apache::functionplotresponse::fpr_xmin,