实时C# - 显示数据 [英] Real time C# - displaying data

查看:92
本文介绍了实时C# - 显示数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我是c#编程的初学者。

我正在开发一个GUI来显示a的值(核板)健身跟踪器,显示心率,脉搏和步数。

i需要实时显示我的步骤,但我不知道怎么做

任何帮助?



我尝试了什么:



另一方面我打算使用阵列我打开一个列表以及

hello,
i'm a beginner in c# programming.
i'm developing a GUI to display the values from a (nucleo board) fitness tracker which displays heart rate, pulse and steps.
i need to display my steps in real time but i'm not sure how to do so
any help?

What I have tried:

i'm planning on using an array on the other hand i'm open to a list as well

推荐答案

请记住,数组是固定大小的:一旦创建,就无法展开它们。并且该列表< T>是隐藏数组( List< ; T> - 它是否真的像您想象的那样高效? [ ^ ])因此,随着样本量的增加,可能存在性能命中。当然,您不希望开始删除头元素,或在前面添加新值。请记住,您每秒钟需要大量样本才能以任何有意义的方式显示。



如果您只显示固定数量的样本 - 最后几千,比如说 - 你可能最好使用队列< t>因为这是回收元素,因为它们被添加和删除而不是重新分配内存。



另一种方法是构建自己的样本链表,这不是特别的复杂。



显示将取决于您要显示的内容,以及如何:当前值数字显示相对简单,而图形图则是有点复杂(我假设你正在看,或者存储多个样本没什么意义)。
Bear in mind that arrays are a fixed size: you can't expand them once created. And that List<T> are arrays-in-hiding (List<T> - Is it really as efficient as you probably think?[^]) so there may be a permformance "hit" as sample sizes start to rise. Certainly, you don't want to start removing head elements, or adding new values at the front. Bear in mind that you will want a significant number of samples per second to make the display in any way meaningful.

If you are displaying only a fixed number of samples - the last couple of thousand, say - you may be better off using a Queue<t> as this "recycles" elements as they are added and removed instead of reallocating memory.

The alternative is to construct your own linked list of samples, which isn't particularly complicated.

Display will depend on exactly what you are trying to display, and how: a "current value" numeric display is relatively simple, whereas a graphical plot is a bit more complex (and what I assume you are looking at, or there is little point in storing multiple samples).


这篇关于实时C# - 显示数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆