Wednesday, April 12, 2017

find the overlapping points of two series in devexpress chart

Leave a Comment

As you can see , I have a winform chart ( DevExpress Chart ) with two series . enter image description here
Each series has their points.
And what I want is to find the overlapping points of those two series ( pointed by green circle in picture ) .

For example ( 3.4 for the first overlapping point and 7.3 for the second overlapping point ) .
Thanks .

3 Answers

Answers 1

If you have direct access to the Series collection, you could:

var intersection = Series[0].Points.Intersect(Series[1].Points);

If you are creating discrete Point objects along the way, you may have to define the matching behavior, as well.

Answers 2

unfortunately, you will not find a direct answer, I faced the same problem once before and it ended up to find a workaround (which mostly will be a mathematic solution based on your business logic of the series).

Answers 3

As I understood each series in your case is just collection of sequantial points. All you need is to find intersection between line segments from each collection. I suggest to use for such purpose Bentley-Ottmann algorithm, which allows to find answer in (N log N) way (N is count of line segments from both series). Unfortunately I don't know whether there is implementation in c# (anytime you can use c++ implementation, if you will not find c# solution)

If you have always two series, defined by some two different functions, you can optimize algorithm in O (N) way (use "merge" logic)

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment