Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
The values of the function are calculated with a certain step, then objects of the LineSegment type are added to the PathFigure collection (if it is not necessary to interpolate) or another inheritor of the PathSegment class corresponding to the required interpolation. For example, bezier curves of the third order - PolyBezierSegment.
Point specifies the new point to continue the graph to.
When calculating, you need to take into account that the Canvas has the origin in the upper left corner, and the Y axis is directed down. Either consider the next point when calculating, or use Canvas transformations.
Should be like this
<Canvas>
<Path Stroke="Black" StrokeThickness="1">
<Path.Data>
<PathGeometry>
<PathFigure>
<LineSegment Point="100,100"/>
<LineSegment Point="150,120"/>
<PolyBezierSegment Points="170,120 190,100 200,160 220,140"/>
</PathFigure>
</PathGeometry>
</Path.Data>
</Path>
</Canvas>
A simple option: calculate the value of the function at several points and connect with segments. The more dots, the smoother the graph will be.
The option is more complicated: use interpolation
Choose a method, depending on your task.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question