Real Time Planning in C #

I am trying to build data on a PDA that is being collected in real time via the bluetooth serial port using C # and windows mobile 5. I am having problems building the data so that it looks smooth. I tried to draw a line from an array of points that worked, but only really displayed individual pieces of data. I found a similar solution on this forum regarding ECG data, which also worked, but again showed a certain amount of data, and then updated very noticeably. I tried to draw points on a bitmap and then draw a bitmap to make it smoother, but again it is not very fast.

What I would like to finish is what behaves like a graph of processor usage history in Windows Task Manager. The data point starts on the right side of the graph and moves smoothly to the left. Is there a standard approach to this problem? I apologize if the question is a bit vague, but I don’t want to spend a lot of time on different things if this is a problem with a well-known common solution.

+4
source share
1 answer

It depends on how you want it to work visually. Using the CPU in the task manager scrolls the entire graph from right to left, and this is not entirely smooth. It refreshes (for me anyway) about once per second, and when it refreshes, then the whole chart “pushes” to the side.

I did something in CF back in 1.0 days as a test, and I decided that the chart would remain static and the data lines would continue sequentially from left to right and when it reached the right edge, it would start drawing back to left again, erasing the oldest data diagrams as it progresses (e.g., ECG).

In this case, your bitmap remains basically unchanged, so you should not redraw the whole thing. I did this using cropping, which was basically a “vertical bar” or a rectangle of the height of the graph, but only, say, 10 pixels wide. I redrawn this strip with updated axis values, so the only bits that actually redraw are a small strip. In addition, an advantage has been added to make visible the “deletion” of the oldest data after I return to the beginning of the graph.

+1
source

Source: https://habr.com/ru/post/1339235/


All Articles