3

I know how to draw a path in WPF by using the Path Geometry and
Stream Geometry .

I want to add a marker to each connection point in a manner similar to Matlab: enter image description here

I can do a lot of small triangle geometries per marker, but is there a better way?

Dr. Andrew Burnett-Thompson
  • 20,980
  • 8
  • 88
  • 178
Andrey Rubshtein
  • 20,795
  • 11
  • 69
  • 104

1 Answers1

1

I would probably do this by overriding OnRender in your chart UserControl and drawing the path first, then markers second.

See this related question.

In it the poster creates a Geometry to represent a triangle then uses the rendering context passed in to OnRender to draw the triangle repeatedly.

You might find if you have a large number of datapoints this method becomes quite slow. You can experiment instead with multiple small blits of a market bitmap to the rendering context, or using the WriteableBitmap API which provides direct access to bitmap & therefore immediate mode rendering.

Edit: You might also be interested in this answer, which discusses high performance WPF graphics in general.

Best regards,

Community
  • 1
  • 1
Dr. Andrew Burnett-Thompson
  • 20,980
  • 8
  • 88
  • 178