In short;

  • The exercise type 'Input Line Graph' lets users draw one or more lines in a graph.
  • The exercise type 'Input Point Graph' lets users draw one or more points in a graph.
  • The exercise type 'Input Point Graph' lets users draw one or more vectors in a graph.

These are all question types where the user can input a graph (input point graph, input line graph and input point graph) have two additional text fields to maintain.

The first is the graph solution field, where the number in the label refers to the answer field. Here you can insert a correct solution in javascript syntax (have a look at Math functions Math), that will be drawn when the student gives up. The syntax differs for the question types. For:

  • points: [x,y], e.g. [0,1]
  • lines: y=x, e.g. y=3*x
  • vector: [x_1,y_1],[x_2,y_2], e.g. [0,0],[2,2]

The second is the graph show field. Here you can insert one or more elements that can be drawn beforehand or influence the graph. The syntax is as a ; separated list per element like [type;arg1;arg2;etc..],[type;arg1;arg2;etc...]

The following elements types are currently supported for drawing:

  • points: where arg1 is x-coordinate and arg2 is the y-coordinate. e.g. [point;2;-2]
  • function: where arg1 is a function in x. Optionally, add arg2 and arg3 as the interval border for respectively the left and right border. e.g. [function;0.5*x*x-2*x;-10;10]
  • polygon: needs at least 4 argumens where arg1,arg2 and arg3,arg4 are the x/y coordinates of the points that will be connected. Any number of additional arguments is allowed as additional points to be connected. e.g. [polygon;0;0;1;1;-1;0]
  • circle: with 3 arguments where arg1,arg2 are the x/y coordinates of the center and arg3 is the radius. e.g. [circle;0;0;5] or alternatively with 4 arguments where arg1,arg2 are the x/y coordinates of the center and arg3,arg4 are the x/y coordinates of a point on the circle line e.g. [circle;0;0;5;5] or alternatively with 5 arguments where arg1,arg2 and arg3,arg4 and arg5,arg6 are the x/y coordinates of a points on the circle line e.g. [circle;0;0;5;5;1;1]
  • text: where arg1 is text that can contain TeX or asciimathml, and arg1 and arg2 are the x/y-coordinates of the position. Optionally, an arg4 can be added as an integer that rotates the text in the degrees of the integer value, however this is not compatible with tex input. e.g. [text;#x=\frac{x^2}{2}-2x#;4;4]
  • vector: with 4 arguments where arg1,arg2 are the x/y coordinates of the start point and arg3,arg4 are the x/y coordinates of the end point. [vector;0;0;5;5]

These elements are supported for influencing the graphing area:

  • grid true or false to show or hide the grid. Default is true
  • info true or false to show or hide the coordinate info box above points. Default is true
  • range for the initial ranges of the axis that are shown. Can be used with one argument (−1⋅arg=xmin=yminandarg=xmax=ymax)(-1⋅arg=xmin=yminandarg=xmax=ymax), two (xmin=ymin;xmax=ymax)(xmin=ymin;xmax=ymax) or four (xmin;xmax;ymin;ymax)(xmin;xmax;ymin;ymax). [range;10] or [range;-10;10] or [range;-1;10;-5;105]
  • xaxis with 1 argument that determines the display value of the x axis, where arg1 is one of 'positive' (for positive only), 'negative' (for negative only), 'none' or 'all' (default is 'all'). [xaxis;all]
  • yaxis with 1 argument that determines the display value of the y axis, where arg1 is one of 'positive' (for positive only), 'negative' (for negative only), 'none' or 'all' (default is 'all'). [yaxis;all]
  • xlabel with 1 argument, where arg1 is the label drawn at the end of the x-axis (default is no label). [xlabel;#x#]
  • ylabel with 1 argument, where arg1 is the label drawn at the end of the y-axis (default is no label). [ylabel;#y#]
  • xlabeloffset with 2 arguments, where arg1,arg2 are the x/y coordinate offset values for the xlabel (default is -15, -15). [xlabeloffset;-15;-15]
  • ylabeloffset with 2 arguments, where arg1,arg2 are the x/y coordinate offset values for the ylabel (default is 10, -10). [ylabeloffset;10;-10]
  • snap with 2 arguments, where arg1,arg2 are the x/y snap to grid values (default is 0.5, 0.5). [snap;0.5;0.5]

Combined examples:
[point;2;-2],[function;0.5*x*x-2*x;-10;10]
or [function;x;-10;10],[function;Math.cos((Math.PI/2)-x);-10;10],[point;0;0]

Note that variables can be used in the above graph fields.

Deprecated, now rather use range, it will have precendence over the variables. ( Note that in these question types, the variables $a, $b, $c, $d are reserved for the initial borders of the graph that are shown, where

  • xminxmin = $a e.g. -10
  • ymaxymax = $b e.g. 10
  • xmaxxmax = $c e.g. 10
  • yminymin = $d e.g. -10 )
Did this answer your question?