Page 1 of 1

Difference beetwen graphs (WPF)

Posted: Fri Nov 23, 2018 8:07 am
by peppemath
Hello
I need to draw two graphs in comparison and at a certain value of the abscissa calculate the difference and draw the difference segment, perhaps with a different color depending on the value of the difference.
Mathematically it is obvious that it is enough to "calculate" the intersection and draw the line between the two points, but does some mechanism already exist in the library?
Can you give me an idea ?? Should you draw a further series or a line ??

Ciao

Re: Difference beetwen graphs (WPF)

Posted: Fri Nov 23, 2018 2:34 pm
by ArctionKestutis
Hello,

Not sure that I grasped your needs exactly but look at Custom shaping and coloring with CustomLinePointColoringAndShaping event
CustomLinePointColoringAndShapingEvent.png
CustomLinePointColoringAndShapingEvent.png (112.33 KiB) Viewed 20078 times
However, the speed of rendering will be slow if you have a lot of point or updating frequently. In that case, adding another series (small excerpt from original) will be more optimal.

Re: Difference beetwen graphs (WPF)

Posted: Mon Nov 26, 2018 8:36 am
by peppemath
No, the question is simple, I have not explained well!
I want to have the two functions y = f (x) and y '= f' (x) and I would like to draw the difference segment at the point x = x0 as in the picture

Re: Difference beetwen graphs (WPF)

Posted: Mon Nov 26, 2018 2:37 pm
by ArctionKestutis
If you wish to draw 'red line', then you can simply use LineCollections (is a collection of line segments; check corresponding example or Manual for illustration).
If you want something more fancy, then you can use Annotation objects - check "Annotations" example (Demo App ->ViewXY -> Others) for variety of shapes and reference systems.

Hope this helps.

Re: Difference beetwen graphs (WPF)

Posted: Tue Nov 27, 2018 12:46 pm
by peppemath
PERFECT!

Grazie