Graph constantly updated

What's problem you are encountering?
I am trying to create a graph that keeps updated constantly over time for a simulator;
i.e.: X axis would be the time and Y axis would be the level of the measured element.
As time goes by the levels would go from right to left keeping updated constantly.

What have you tried that didn't work?
I have imagined an array of variables each one representing a value of Y that are passed by from right to left after a second, the first one really being the only one with fresh values.
It does work, but I was wondering if I am taking the most inefficient way to create this.

Post a project example, link, or screenshot:

Thanks a lot for your help

What do you need 25000 sprites for?

I'm not sure exactly what you're trying to do, because when I run your program it just plots a horizontal line. But in any case, just dedicate one sprite to drawing the graph:

If you can press the up and down arrow you'll see that the values of the graph get moved to the left ...
the graphic is dynamic and would get constantly updated based on other inputs.

they represent each point of the graph and move vertically. I know there must be a better way to get it done...

Yes, use clones.

thank you! I will play around with them.

Oops I meant x position of course.

My graph project:
Snap! 6.5.2 Build Your Own Blocks (berkeley.edu)

You can try to store data in a list, then set up a clones swarm for every sample "No."
DT1 test script pic (4)

Each clone can update its position
DT1 test script pic (6)
or better yet
DT1 test script pic (1)

And samples can be updated this way...
DT1 test script pic (5)

...
...

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.