I'm trying to solve following issue. Let's say I'm sampling data once per second and showing it on the graph. I want to show history of the data, say last 20 plots using the same color with fading. What I do now:
- create 21 plots, say Plots[0]..Plots[20]
- at meas 1, set Data[0] = data
- set Plots[0] opacity to 1
- at meas 2, set Data[1] = data
- set Plots[1] opacity to 1, Plots[0] opacity to 0.5
- at meas 3, set Data[2] = data
- set Plots[2] opacity to 1, Plots[1] opacity to 0.6, Plots[0] opacity to 0.3
...
- at meas 21, set Data[20] = data
- set opacity to 0.1..1
// we're fine as of now, here comes the tricky part
- at meas 22 I need to remove the data of meas 0 (stored at Data[0]) and replace it with the new data
- so I set Data[0] = data
- set Plots[0] opacity to 1 (it's the newest result)
- set other plots opacity 0.1..0.9
// and here is the problem: Plots[0] is now at the bottom of the plot stack and is covered by 20 other plots, thus is barely visible
so I somehow need to move Plots[0] to the top of the stack
I've tried removing Plot and Data of the farthest plot and adding creating plot with the most recent data, but it leads to incorrect indices (Plot.Index grows all the time, but Data array stays the same)
Another option would be to fix plots order and opacity in advance, and change data for all plots all the time. But I assume this would be very slow (think of 20-50 copies of the plot with say 1000 points).
So, any bright ideas here?