cellContent from Graph component

I’m constructing an activity investigating circles. In screen 3 I’ve used a graph component and defined two local variables: diameter and circumference. I’ve then set screen 4 as a table component where i want to import the values of these variables. I’m using the cellContent command as a Sink (i think) but keep getting an error that the command expects a string in the source not a number. From reading the documentation that makes sense but I saw in a post here from December '18 “[Populate table cell with graph value]”(Populate table cell with graph value) that it could be possible to use a number source.
I’d also like to show the values of D and C (calculated in the graph) not the labels if possible but was not sure how to use the pointLabel command with a value not a string.
I’ve attached my draft version of my activity if anyone is willing to take a look.
Circle Circumference • Activity Builder by Desmos

Your variables in slide 3 are a little confusing, but if you want to take variables from the graph in slide 3, you’ve got a few things to change to make it easier. There’s not much use for functions i(x) and j(x). In the graph, make variable D and C.

D=2k
C=π*d

Name the graph component. Graph3 for example, then since cellContent won’t take numbers directly you need to call the variable inside quotes. ${ } lets you use a variable in text.

cellContent(1,1): "${Graph3.number("D")}"

1 Like

@Daniel_Grubbs. Thank you so much for the help. I’m new to CL and don’t have any experience of coding so this is doubly appreciated. I’ve deleted i(x) and j(x) as you suggested. Can I use a similar syntax for the source in the pointLabel command? :smiley: :smiley:

Tried it with pointLabel ="${Graph1.script.diameter}" and similar for circumference. It showed as correct but when i set the labels to diameter and circumference the values didn’t show up. Couldn’t figure out why until I went into student preview where they did show up. Note to self: check preview if the code is showing as correct before assuming it’s not working!

I believe because you’re setting the pointLabel in the CL it doesn’t show in editing mode because the code isn’t being run. So, when you preview, any CL code is ‘activated’ because the code is now being read.