Charting.DataPointCollection how to get a Range?

百般思念 提交于 2020-01-05 04:40:11

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/20327721/charting-datapointcollection-how-to-get-a-range

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!