09-10-2024 01:13 AM
Hello
I want to show timestamp in X axis and multiple CH's numeric values on Y axis
My application is that I am getting data from 15 CH's of CAN bus and would like to plot this data on Chart with Absolute timestamp
I tried with Waveform Chart since it was fairly simple, but as the duration of the test is long almost 7-8 days, the timestamp was not consistent with the PC actual time. I figured that the while loop iterations are not always constant, so created the problem
Therefore I have shifted from Chart to XY graph where I can insert the timestamp dynamically during each iteration.
Please find attached vi for the same. I am able to shift the data to left after the circular array size is achieved i.e. say 100 iterations.
My problem statement:
1. For the first 100 samples the data is cramped in the graph and after the 100 iterations, the circular buffer logic starts working so, the data then starts shifting to the left. I want to see the data transition to the left after say 50 samples, so it looks neat something like the built in feature of the Waveform Chart . I played with the properties like "minimum, offset, maximum and multiplier", but could not get it working
2. Is it possible to show the transition from left to right, rather than right to left similar to waveform chart.
Snippet:
Thanks
Solved! Go to Solution.
09-10-2024 02:12 AM
This isn't an "embedded systems" topic at all. Circular buffers are used everywhere, where you, you know, need a circular buffer. They're good for continuous reading from sensors via DMA, they're good for keeping a log of error messages and other operational messages similar to e.g. how Linux does, one might use circular buffers for some sort of terminal emulator interface and so on.
09-10-2024 02:17 AM
Hi Patil,
@VihangPatil wrote:
My problem statement:
1. For the first 100 samples the data is cramped in the graph and after the 100 iterations, the circular buffer logic starts working so, the data then starts shifting to the left. I want to see the data transition to the left after say 50 samples, so it looks neat something like the built in feature of the Waveform Chart . I played with the properties like "minimum, offset, maximum and multiplier", but could not get it working
2. Is it possible to show the transition from left to right, rather than right to left similar to waveform chart.
09-10-2024 04:10 AM
Hello GerdW
Can you kindly modify the code and attach. Because I am not getting it to work somehow
Thanks
09-10-2024 01:50 PM
Anyone who could kindly guide? Or modify the missing part
09-10-2024 02:27 PM
to show from right to left, just double click on the time stamp, type "0", the graph will update from Right to left.
Use circular buffer size 50 will do what you need.
09-11-2024 09:54 AM
Thanks for the tip
Changing the 0 to right, made scrolling from right to left
Using 50 as circular buffer actually is not giving me what I intended.
I have an X scrollbar and it should show be scrollable , I want to show 50 samples at any given moment on the screen, after the 50 samples the screen should scroll and I need to store history of 1000 samples
The circular buffer I want to implement is such that the memory(history) is restricted to 1000 samples only and PC memory should not overrun
This is my requirement.
Currently the history length and samples length is the same, therefore the scrollbar is not scrollable.
Thanks
09-11-2024 11:10 AM
You need to initialize the buffer with 1000 points in memory , and replace every new data on the buffer, to the pointer at every iteration. You can then get a subset of 100 points and update the plot...there is some extra work to be explored, but consider you have a set of 1000 points in memory , you need to massage your data to show what you want on the plot to be "scrollable"...
09-11-2024 01:20 PM
I have modified the code further where now, I got the Scrollbar functionality working, i.e. I have now the history data.
But one thing which is still not as per my liking is the feel that the Waveform Chart would give, like continuous data scrolling
In my modified code the data is shown till the period of 10 secs and then it gets blank and again the data starts to show from the left. This is undesirable. I want the last 10 secs data always visible
I would like to have a history of 1 minute. So I have kept the circular buffer of 6000, and would like to show live data of 10 secs
Little help modifying the code would be great. I want the scrolling feature similar to the Waveform Chart
09-11-2024 02:16 PM
Hello Fibo
I am trying to achieve the same using XY graph. But struggling to get the XY Graph to work like Waveform Chart
I want to also add timestamp to the Xaxis. Can you please share your code
This is my code where i am struggling
Thanks