Charting.DataPointCollection how to get a Range?

2019-08-11 01:28发布

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?

标签: c# charts
1条回答
别忘想泡老子
2楼-- · 2019-08-11 02:24

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.

查看更多
登录 后发表回答