Layering a Graph and Sketch

I can’t get the interactive parts of the graph to stay in place when I toggle it back to a Sketch in (Screen 4 of) this activity. I copied all the coding of the button, sketch, and graph from (screen 3 of) this activity where it does work. What am I missing/doing wrong?

Not sure why it’s resetting. I’m sure there’s a developer reason. However…

There aren’t a whole lot of components in your graph. You may want to redo your draggable points with sliders instead, and a list of those sliders. You can then copy the graph by exporting to the Desmos calculator and then copying the share link back into the sketch graph. Then, use the sketch CL to define all the sliders based on the graph.

For example, once you’ve define the point in the graph for the first 1, as:

(x1,y1)
x1=2
y1=2
X=[x1,x2,x3,x4,x5,x6]
Y=[y1,y2,y3,y4,y5,y6]

Then in your sketch CL:

numberList(`X`): Graph.numberList(`X`)
numberList(`Y`): Graph.numberList(`Y`)

In your sketch’s graph, you’ll want to define sliders by the list:

x1=X[1]
x2=X[2]
y1=Y[1]
...etc