Skip to main content
How to create (parameterised) graphs in my exercise?
Thijs Gillebaart avatar
Written by Thijs Gillebaart
Updated over a week ago

Two-dimensional line charts can be a great way to illustrate concepts and enable you to ask a wide array of questions. And by using parameters in the definition it is possible to create multiple exercises on the same concept without the need to create many charts by hand.


Even more interesting is to use the answer of the student to plot a line in a chart to provide visual feedback.


In this article we explain how you can create these line charts.

What can you achieve?

With generated line charts you can achieve the following:

  • add charts to your exercise by simply typing math

  • create a parameterised chart by using parameterised functions

  • use the student's answer in charts to generate specific feedback based on the student's specific answer

  • add these charts in the description, question or feedback of an exercise

Below you can read more on how to create these graphs and what the options are.

How to add a graph to an exercise

A chart can be added in any editor field by following these steps

  1. Click at the location you want to add the chart (note: charts can only be added on a new empty line)

  2. Click on the floating "+ button" on the on the left side of the screen near the start of the line

  3. Click the line-chart icon in the menu

Available options

After you've added a chart you can configure the chart by adding lines and defining labels and plot ranges.

At this moment the following options are available to define the chart:

  • add / remove multiple lines by defining a formula

  • change the colour of the line

  • define the label for each line (default the formula itself)

  • hide or show the legend with line labels

  • define the range of the x-axis and y-axis

  • define the label for each axes (default 'x' and 'y')

In the example below we added two lines, label for the lines and changed the axis limits.

If you preview the exercise, you can see how the graph will look like when students will practice the exercise.

It is important to note that the line’s formula at the line settings must be written in terms of x. This means that if in your exercise, you want to present how position changes in terms of time for an object in constant velocity (v), and decide to have distance in the y-axis and time in the x-axis, the formula in the line settings should be v*x, and not v*t.

Size and position of the graph

To position the graph inside your exercise, there are several size and alignment options available:

  • specify whether the chart should be positioned on the left, in the middle, or on the right of the element in which you added the chart.

  • specify the width to be 50% (default) or 100% of the exercise

You can configure these options using the buttons in the top right corner of the graph.

Deleting a graph

You can only delete a graph by clicking the button "remove graph" in the top right corner. You can't delete a graph by using Backspace or Delete button.

Plotting the student's answer in a graph for feedback

You can plot the student's answer in the feedback, alongside other lines. To create such visual feedback, you have to use answer rules. Read more about how answer rules work here.


An example of this is shown below, where the green line is based on the student's answer.

To create a chart with the student's answer in the feedback, please take the following steps:

  1. Click "edit answers and specific feedback" at the bottom of the answer input field. This will open the specific feedback and answer rules options.

  2. Add a rule (see answer rules article for more detail) to determine when to show the feedback. In the example below the rule specifies "if the answer is not equivalent to 4" (but is defined)

  3. Add a chart as you've done in the exercise itself and configure it as you want.

  4. Use the answer parameter "student.answerX" to plot the answer of the student.

  5. Close the specific feedback window and save the exercise.

For the example exercise the answer rule and feedback is shown below.

Do you want configure additional options?

At this point we are collecting feedback on this feature. If you have any questions about or feedback on this functionality, just let us know via the chat or email!

Did this answer your question?