Charting.DataPointCollection如何获取Range? [英] Charting.DataPointCollection how to get a Range?

查看:313
本文介绍了Charting.DataPointCollection如何获取Range?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Charting.DataPointCollection,并且只想得到一部分数据。在列表中你可以像 list.GetRange(int index,int count); ,但在DataPointCollection中没有GetRange()。



我有这样的想法: DataPoints.Where(elem => DataPoints.IndexOf(elem)> = i&& DataPoints.IndexOf (elem)<= j)但现在我有一个IEnumerable而不是DataPointCollection ...



如何获得DataPointCollection

尝试使用 IndexOf()

$

c>

  DataPoints.Skip(number).Take(number); 

对于获得 DataPointCollection 我没有找到任何合理的方法直接转换。只有我想出了创建一个新的系列并将数据点逐个插入到它的集合一个循环。


I have a Charting.DataPointCollection and want to get only a part of the data. In a List you can do it like list.GetRange(int index, int count); but in DataPointCollection you don't have GetRange().

I had the idea of using something like that: DataPoints.Where(elem => DataPoints.IndexOf(elem) >= i && DataPoints.IndexOf(elem) <= j) but now i have an IEnumerable instead of a DataPointCollection...

How can i get a DataPointCollection as a Part of another DataPointCollection?

解决方案

Try this instead of using IndexOf()

DataPoints.Skip(number).Take(number);

As for getting result as the DataPointCollection, I haven't found any reasonable way of converting it directly. Only thing I came up with is create a new Series and insert the data points one by one to its Points collection in a loop.

这篇关于Charting.DataPointCollection如何获取Range?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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