Search code examples
c#arrayscopyzedgraph

How to get an array or a list of y axis data from the curve item


I have a list item(myList) on the Zedgraph,

PointPairList myList = new PointPairList();

myList has some values in it, now I want to copy just the y values alone into a new array.

My Trails:

myList.toArray(); // Seems to return a complete set of pointpair list
myList.GetRange(); // Gets a range of pointPair list

I'm looking to find a way, to copy just the y Data.

Thanks in advance....:)


Solution

  • Use

    double[] yvalues = myList.Select(p => p.Y).ToArray();
    

    For this you need to include System.Linq namespace this way

    using System.Linq;