recording = 0
event that starts recording: set size array to 0,1,1
set recording = 1
every tick AND recording = 1: push array at back x-axis, value = touch.AccelerationX (or whichever value you are interested in)
to stop recording set recording to 0 again.
to plot it, by using the canvas plugin:
~event that starts the plotting~: canvas begin path
canvas path move to start point
- for 0 to array.width-1: canvas line to x=loopindex y=300-array.at(loopindex)
- canvas draw line
If you want a continuos plot, you probably need to draw the (complete) line each tick instead and if there are more than maybe 200 elements in the array, you delete the first array OR for a more simple approach spawn a small pixel every tick with the bullet behaviour at the right and let it move to the right and destroy when it is off the graph.