# Tying graph shading to a clickable object

**URL:** <https://cl.desmos.com/t/tying-graph-shading-to-a-clickable-object/4329>\
**Category:** Questions\
**Created:** [May 30, 2022, 2:00pm UTC](https://cl.desmos.com/t/tying-graph-shading-to-a-clickable-object/4329 "2022-05-30T14:00:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hannah\_Keith](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/hannah_keith/32/2709_2.png) [@Hannah\_Keith](https://cl.desmos.com/u/Hannah_Keith)\
**Post date:** [May 30, 2022, 2:00pm UTC](https://cl.desmos.com/t/tying-graph-shading-to-a-clickable-object/4329/1 "2022-05-30T14:00:52Z")

</div>

Hello! I am attempting to create a test question which requires students to graph a system of inequalities using movable points. I have no problem with setting the actual lines to graph, but I am having some difficulty with setting up the code to allow students to choose the location of the shading and the type of line they need (dotted or solid). I had tried to set a clickable object to control the shading and an action button to control the type of line used, but I am stuck! Any help would be much appreciated ![https://teacher.desmos.com/activitybuilder/custom/6291080a3995740520e9d900](https://teacher.desmos.com/activitybuilder/custom/6291080a3995740520e9d900)

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [May 30, 2022, 4:39pm UTC](https://cl.desmos.com/t/tying-graph-shading-to-a-clickable-object/4329/2 "2022-05-30T16:39:42Z")

</div>

Can you reshare your link? There’s something not working.

You can toggle between choices using modular math. This would change the value between 0 and 1, which you can use as a condition, or set a graph number:

```auto
dottedOrSolid= numericValue(`\mod(${this.pressCount},2)`)

```

Personally, I’d probably just use a couple multiple choice, and set some numbers in the graph to use as a conditional:

```auto
#solid vs dotted (nonstrict vs strict)
number(`n_1`): when mc1.isSelected(1) 1 otherwise 0
#shade above vs below (y> vs y<)
number(`n_2`): when mc2.isSelected(1) 1 otherwise 0

```

then use n\_1 and n\_2 as restrictions in the graph:

```auto
y<=f(x) {n_1=1}{n_2=0}
y<f(x) {n_1=0}{n_2=0}
y>=f(x) {n_1=1}{n_2=1}
y>f(x) {n_1=0}{n_2=1}

```

---

<div class="post-metadata">

**Author:** ![Hannah\_Keith](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/hannah_keith/32/2709_2.png) [@Hannah\_Keith](https://cl.desmos.com/u/Hannah_Keith)\
**Post date:** [May 31, 2022, 4:42am UTC](https://cl.desmos.com/t/tying-graph-shading-to-a-clickable-object/4329/3 "2022-05-31T04:42:51Z")

</div>

> [@Daniel\_Grubbs](#):
>
> `number(`n\_1`): when mc1.isSelected(1) 1 otherwise 0`

Thank you for your help! It worked once I set the coding this way. Here is the link to the finished version:

> **[System of Inequalities Question • Activity Builder by Desmos](https://teacher.desmos.com/activitybuilder/custom/6291080a3995740520e9d900)**
>
> by Hannah Keith

\*Note: This question came from a KSA practice test.
