Button to Make Points on a Table Graph

I’m creating an activity where the students have to put a point in the table and when they click the button labeled “shoot” then it graphs the point listed on the table. That way they can see if they “made a basket.”

Problem is I am an absolute layman when it comes to coding unfortunately.

I looked through the CL documents and I wasn’t sure that I found anything describing how to make the button work for the table.

Any and all help is appreciated. If you have questions or need more details from me, please feel free to ask.

Thanks in advance!

In the graph CL:

number(`a`): when button.timeSincePress>0 table.cellNumericValue(1,1)
           otherwise 100
number(`b`): when button.timeSincePress>0 table.cellNumericValue(1,2)
           otherwise 100

Then in the graph: (a,b)
Alternatively, if you want students to use coordinate notation, you could just use an input:

number(`a`): when button.timeSincePress>0 numericValue(parseOrderedPair(input.latex).x)
           otherwise 100
number(`b`): when button.timeSincePress>0 numericValue(parseOrderedPair(input.latex).y)
           otherwise 100

(Change “button”, “table”, and/or “input” to whatever name you’ve given those components.)

Ok I used your top one (thank you so much by the way).
But for some reason nothing is happening when I press the button. Is there something that needs to be in the button’s CL or the table’s CL?

As long as it’s in the graph CL, you have (a,b) in your graph, and your component names match, it should work. Can you publish and share your activity?

Seems to be working fine for me. The point color is almost the same as the hoop color. (You could also use a basketball image with (a,b) as the center.)

1 Like

Ok weirdly it works for me now too. I don’t know. Sorry for wasting your time there.

Thanks for the tip about the basketball!

1 Like