Diff for /loncom/homework/functionplotresponse.pm between versions 1.43 and 1.45

version 1.43, 2010/11/20 21:35:53 version 1.45, 2010/11/23 23:14:20
Line 295  ENDAXESSCRIPT Line 295  ENDAXESSCRIPT
 }  }
   
 sub axes_label {  sub axes_label {
     my ($id,$xlabel,$ylabel)=@_;      my ($id,$xmin,$xmax,$ymin,$ymax,$xlabel,$ylabel)=@_;
     unless ($xlabel || $ylabel) { return ''; }      unless ($xlabel || $ylabel) { return ''; }
     my $return='document.ggbApplet_'.$id.'.evalCommand("topRight=Corner[3]");';      my $return='document.ggbApplet_'.$id.'.evalCommand("topRight=Corner[3]");';
     if ($xlabel) {      if ($xlabel) {
         if (($ymin<0) && ($ymax>0)) {
        $return.=(<<ENDXAXISLABELSCRIPT);         $return.=(<<ENDXAXISLABELSCRIPT);
 document.ggbApplet_$id.evalCommand("Xlabel=(x(topRight)-AxisStepX[],AxisStepY[]/6)");  document.ggbApplet_$id.evalCommand("Xlabel=(x(topRight)-AxisStepX[],AxisStepY[]/6)");
 document.ggbApplet_$id.setVisible("Xlabel",false);  document.ggbApplet_$id.setVisible("Xlabel",false);
 document.ggbApplet_$id.evalCommand("Text[\\"$xlabel\\", Xlabel]");  document.ggbApplet_$id.evalCommand("Text[\\"$xlabel\\", Xlabel]");
 ENDXAXISLABELSCRIPT  ENDXAXISLABELSCRIPT
         } else {
          $return.=(<<ENDXOFFAXISLABEL);
   document.ggbApplet_$id.evalCommand("LowerRight=Corner[2]");
   document.ggbApplet_$id.evalCommand("Text[\\"$xlabel\\", (x(LowerRight) - AxisStepX[], y(LowerRight) + AxisStepY[] / 2)]");
   ENDXOFFAXISLABEL
         }
     }      }
     if ($ylabel) {      if ($ylabel) {
         if (($xmin<0) && ($xmax>0)) {
        $return.=(<<ENDYAXISLABELSCRIPT);         $return.=(<<ENDYAXISLABELSCRIPT);
 document.ggbApplet_$id.evalCommand("Ylabel=(AxisStepX[]/6,y(topRight)-AxisStepY[]/3)");  document.ggbApplet_$id.evalCommand("Ylabel=(AxisStepX[]/6,y(topRight)-AxisStepY[]/3)");
 document.ggbApplet_$id.setVisible("Ylabel",false);  document.ggbApplet_$id.setVisible("Ylabel",false);
 document.ggbApplet_$id.evalCommand("Text[\\"$ylabel\\", Ylabel]");  document.ggbApplet_$id.evalCommand("Text[\\"$ylabel\\", Ylabel]");
 ENDYAXISLABELSCRIPT  ENDYAXISLABELSCRIPT
         } else {
          $return.=(<<ENDYOFFAXISLABEL);
   document.ggbApplet_$id.evalCommand("UpperLeft=Corner[4]");
   document.ggbApplet_$id.evalCommand("Text[\\"$ylabel\\", (x(UpperLeft) + AxisStepX[] / 5, y(UpperLeft) - AxisStepY[] / 1.8)]");
   ENDYOFFAXISLABEL
         }
     }      }
     return $return;      return $return;
 }  }
Line 467  sub start_functionplotrule { Line 481  sub start_functionplotrule {
                                    ['1','First derivative'],                                     ['1','First derivative'],
                                    ['2','Second derivative'],                                     ['2','Second derivative'],
                                    ['-1','Integral']],$token).'<br />'.                                     ['-1','Integral']],$token).'<br />'.
              &Apache::edit::text_arg('(Initial) x-value:','xinitial',               &Apache::edit::text_arg('Initial x-value:','xinitial',
                                       $token,'8').                                        $token,'8').
              &Apache::edit::select_or_text_arg('(Initial) x-value label:','xinitiallabel',               &Apache::edit::select_or_text_arg('Initial x-value label:','xinitiallabel',
                                                [['start','Start of Plot']],$token,'8').'<br />'.                                                 [['start','Start of Plot'],
                                                   ['end','End of Plot']],$token,'8').'<br />'.
   
              &Apache::edit::text_arg('Optional final x-value for ranges:','xfinal',               &Apache::edit::text_arg('Final x-value (optional):','xfinal',
                                       $token,'8').                                        $token,'8').
              &Apache::edit::select_or_text_arg('Optional final x-value label:','xfinallabel',               &Apache::edit::select_or_text_arg('Final x-value label (optional):','xfinallabel',
                                                [['end','End of Plot']],$token,'8').'<br />'.                                                 [['end','End of Plot']],$token,'8').'<br />'.
              &Apache::edit::text_arg('Optional minimum length for range:','minimumlength',               &Apache::edit::text_arg('Minimum length for range (optional):','minimumlength',
                                      $token,'8').                                       $token,'8').
              &Apache::edit::text_arg('Optional maximum length for range:','maximumlength',               &Apache::edit::text_arg('Maximum length for range (optional):','maximumlength',
                                      $token,'8').'<br />'.                                       $token,'8').'<br />'.
              &Apache::edit::select_or_text_arg(&mt('Relationship:'),'relationship',               &Apache::edit::select_or_text_arg(&mt('Relationship:'),'relationship',
                                   [['eq','equal'],                                    [['eq','equal'],
Line 562  sub start_spline { Line 577  sub start_spline {
              &Apache::edit::text_arg('Index:','index',               &Apache::edit::text_arg('Index:','index',
                                      $token,'4').'&nbsp;'.                                       $token,'4').'&nbsp;'.
              &Apache::edit::select_arg('Order:','order',               &Apache::edit::select_arg('Order:','order',
                                   ['2','3','4','5','6','7','8','9'],$token).'&nbsp;'.                                    ['2','3','4','5','6','7','8'],$token).'&nbsp;'.
              &Apache::edit::text_arg('Initial x-value:','initx',               &Apache::edit::text_arg('Initial x-value:','initx',
                                      $token,'4').'&nbsp;'.                                       $token,'4').'&nbsp;'.
              &Apache::edit::text_arg('Initial y-value:','inity',               &Apache::edit::text_arg('Initial y-value:','inity',
Line 1212  sub start_functionplotelements { Line 1227  sub start_functionplotelements {
      $result.=&start_init_script($internalid);       $result.=&start_init_script($internalid);
 # put the axis commands inside  # put the axis commands inside
      $result.=&axes_script($internalid,$xmin,$xmax,$ymin,$ymax,$xaxisvisible,$yaxisvisible,$gridvisible);       $result.=&axes_script($internalid,$xmin,$xmax,$ymin,$ymax,$xaxisvisible,$yaxisvisible,$gridvisible);
      $result.=&axes_label($internalid,$xlabel,$ylabel);       $result.=&axes_label($internalid,$xmin,$xmax,$ymin,$ymax,$xlabel,$ylabel);
 # init script is left open  # init script is left open
   }    }
   return $result;    return $result;

Removed from v.1.43  
changed lines
  Added in v.1.45


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>