-1

I want to know the intersection of tow lines on same chart in C#. the Code is below. Is this OK ?

DataPoint dp=new DataPoint(); 
Bool TF;

TF=dp.Equals(Chart1.Serise["Curve1"].Points.Intersect(chart1.Series["Curve2"].Point));

// TF will decide that line intersect or not

But this didnt work for me. Please help I am new to this forum . Please forgive me if i have write something wrong.

Dmitry Bychenko
  • 180,369
  • 20
  • 160
  • 215
Syed Raza
  • 1
  • 3
  • 1
    Please post a clear example and explain what you tried so far. – Wicher Visser May 24 '16 at 07:26
  • The line insetction algorithm should help provided your datapoints have numeric x and y-values. – TaW May 24 '16 at 09:09
  • I find a related post on the page http://stackoverflow.com/questions/24133067/access-intersection-point-of-between-a-curve-graph-and-a-line. i will send it snap but i dont know how to attach that file. – Syed Raza May 24 '16 at 11:00

1 Answers1

-1

The Intersect method is defined in MSDN as

The intersection of two sets A and B is defined as the set that contains all the elements of A that also appear in B, but no other elements.

If for example Curve1 have points 1,1 and 2,2 and Curve2 have 1,2 and 2,1, then a line between those coordinates in each curve/series will intersect visually, but the collections will not intersect as none of the collections have the same coordinates.

To calculate line intersection, you have to do some math and is answered in another SO question.

Community
  • 1
  • 1
Adam B
  • 506
  • 1
  • 5
  • 13