Slope Expressed as A Fraction

Hi everyone. Here is an activity that I am trying to tweak.

In the 2nd slide, there is a variable that is defined ${graph1.number(“s_{lope}”)}. It is displayed as a decimal in the note component on the top right. Is it possible for this number to be displayed as a fraction by default?

Thanks as always for the help.

CL that pulls values will only take the decimal value. If you want it as a fraction, you’ll need the numerator and denominator defined in the graph and format in the note:

`\frac{${graph1.number(`n`)}{${graph1.number(`d`)}}`

You may want to define your fraction using a when-otherwise to conditionally display as an integer:

myFrac= when graph1.number(`d`)=1 "`${graph1.number(`n`)}`"
               otherwise "`\frac{${graph1.number(`n`)}{${graph1.number(`d`)}}`"
content: "...The slope is ${myFrac}."