Segment values

Oct 7, 2011 at 12:27 PM
Edited Oct 7, 2011 at 12: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 5:05 AM

Hi,

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

Regards

 Ravi.

Oct 12, 2011 at 11:26 AM

Thank you very much, Ravi.