Yes... a graph question. Static amount of points

Hello all. All a bit new, so here goes..

I have a graph that is reporting a set of values and all works fine

I kinda worked this out from:

https://community.appinventor.mit.edu/t/how-do-you-use-the-chart2d-plugin-to-create-a-chart-with-time-as-the-horizontal-axis/88373/2

But, I don't like the way it keeps resetting the screen after 10 points of data (yes, I know that is the clear chart commands job).
Ideally, I would like to keep the scrolling data to a constant last 10 points of data on the screen.
For this, I would assume I need to somehow firstly fill up a list? with the first 10 X values, and then after 10 values have arrived, continually shift these values down the list and display them? (deleting the previous plotted point first for each X position).

Is a list the correct item to use?

Any guidance would be great. Been searching, Googling and experimenting for a couple of evenings now and not cracked it.

See here for an example of how to do what you want:

Thanks.

Nearly there...

I have the graph scrolling. Needed to turn off the 'XFromZero' and 'YFromZero' boxes in the designer as well.

The pic show the blocks. If I enable the 'global y = 10' (black arrow), then the graph works with y temporary set at 10. Fine for testing.

Above that (red arrow) is the actual incoming data. It arrives in a string over BLE and if the string includes '3000' starting at position 3, then it's information for the graph.
That part works fine.

The actual data to show on the graph is within the string starting at position 7.
How do I convert the 'global Incoming _data' text that is extracted using the text extraction block and convert that to a usable variable?

Don't worry... got it.
Thank you for the assistance

Hi. Got the app and graph working well.

Only thing is I don't want the X value to just run off into the distance and get bigger and bigger.

Arrow shows my reset line, but this messes up the graph and I get some weird line with points on it until the first 12 points are plotted, then it starts correctly.
How do I reset the graph? I also added chart.clear, but that didn't work (for some reason)

Ideas?

Here is a general solution for just showing the latest arrivals:


charts_drunkard_walk.aia (3.0 KB)
Sample run

Hmm.... the bottom X values are not increasing like mine do?

I will have to investigate

Where do I find that first purple block? Call 'addEntry, chartData, maxEntries?

Its not in any of my chart block lists?

Don't worry - imported it from the example

Take a look at this:
http://www.appinventor.org/bookChapters/chapter21.pdf

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