Segment values

Oct 7, 2011 at 1:27 PM
Edited Oct 7, 2011 at 1:28 PM

How can I get the Y value of segment, if I know X. 

(X,Y) - inner point of segment.  

Oct 10, 2011 at 6:05 AM


If you observer chart data is IList<Point> collection. this point can be converted as mouse coordinates or data coordinates using ViewPort.Transofrm.ScreenToViewPort or ViewPortToScreen.

use some expression (:ambda\Linq) to get this

var pt = ValuePoints.Select((item, index) => new { Index = index, Item = item }).Where(p => p.Item.X > point.X).FirstOrDefault(); //point.X is your known X value
double y = ValuePoints[pt.Index].Y //is your Y value



Oct 12, 2011 at 12:26 PM

Thank you very much, Ravi.