Difference beetwen graphs (WPF)

Need help in implementing some specific function to your LightningChart Ultimate powered application? Post a question and get code snippets from other LightningChart Ultimate community members.

Moderator: Queue Moderators

Post Reply
peppemath
Posts: 12
Joined: Tue Mar 06, 2018 10:50 am

Difference beetwen graphs (WPF)

Post by peppemath » Fri Nov 23, 2018 8:07 am

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

ArctionKestutis
Posts: 549
Joined: Mon Mar 14, 2016 9:22 am

Re: Difference beetwen graphs (WPF)

Post by ArctionKestutis » Fri Nov 23, 2018 2:34 pm

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 19157 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.

peppemath
Posts: 12
Joined: Tue Mar 06, 2018 10:50 am

Re: Difference beetwen graphs (WPF)

Post by peppemath » Mon Nov 26, 2018 8:36 am

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
Attachments
DiffGraphs.jpg
DiffGraphs.jpg (298.93 KiB) Viewed 19151 times

ArctionKestutis
Posts: 549
Joined: Mon Mar 14, 2016 9:22 am

Re: Difference beetwen graphs (WPF)

Post by ArctionKestutis » Mon Nov 26, 2018 2:37 pm

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.

peppemath
Posts: 12
Joined: Tue Mar 06, 2018 10:50 am

Re: Difference beetwen graphs (WPF)

Post by peppemath » Tue Nov 27, 2018 12:46 pm

PERFECT!

Grazie
Attachments
DiffGraph_002.png
DiffGraph_002.png (60.01 KiB) Viewed 19145 times

Post Reply