How to draw digital datas as a continuous signal in C#?
I am dealing with a project and for now I can get analog signals from my sensors and with PIC's ADC, convert them to digital datas. Besides, via USB I can transfer all the datas to my windows application (user interface) which is made by C#. When I look into my inputbuffer, all the datas there.
My problem is after these steps, how can I draw these datas as a continuous signal? I use ZedGraph and I want to observe my sensor datas as a continuous signal. I know how to draw something using ZedGraph. I even drew my inputbuffer only one time. But still I cannot manage it as a continuous signal.
Which architecture is more suitable for me? Should I use circular buffer?
Can I use PerformanceCounter class as my custom events such as drawing my sensor datas or this class is only useful for system events? 开发者_运维技巧
You could create a Performance Counter, that is easy to do.
Drawing the graph yourself is a bit harder:
(I take it you mean by continuous signal a line instead of points) Just draw a line from the previous position to the current position.
A circular buffer might help (although the oldest data should shift back in I think) but you still need to keep track of the previous position so you know how to draw the line. Make sure you shift the buffer in proportion to the time elapsed.
An alternative would be to be to push the data to an Excelsheet and use the charts there.
Can't you just assign a timestamp to each data point in your sample? Then you should be able to easily plot the sample using time as X-axis and value as Y-axis with zed-graph, only need to adjust some parameters like line smoothing etc.
精彩评论