How to create (parameterised) graphs in my exercise?
Do you want to use 2D line chart in your exercise based on parameters or a student's answer? Read below how you can generate line graphs.
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.

# Summary

With generated line charts you can achieve the following:

• 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 can you add a chart to an exercise?

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

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

• click on the floating "+ button" on the on the left side of the screen near the start of the line

• click the line-chart icon in the menu

# Which options are available when creating a line-chart?

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.

# How to size and position 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.

# Can I plot the student's answer in the feedback?

Yes 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.