在我的程序中,我每秒在调度程序中轮询一次以接收当前的网络吞吐量:
private PerformanceCounter netSndCounter =
new PerformanceCounter("Network Interface", "Bytes Sent/sec");
private PerformanceCounter netRcvCounter =
new PerformanceCounter("Network Interface", "Bytes Received/sec");
private void updateTimer(object sender, EventArgs e)
{
netSndCurrent = netSndCounter.NextValue();
netRcvCurrent = netRcvCounter.NextValue();
}
这运行良好...但是,我想以某种方式将其显示为图表。类似于您在性能选项卡中的 Windows 任务管理器中看到的图形。我可以使用任何简单而轻量级的工具来完成此操作吗?
有没有没有第三方库的好方法?
可以使用 WPF 类ChartPlotter
来制作图形。
有关一些示例,请参见:C# WPF 应用程序中的 msdn 和动态折线图
或者,如果你想要一些第三方库,你可以看看这篇文章:WPF图表控件