Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

WPF MS2015 Graph very slow

Hello,

 

For some times i've seen that the WPF version of MS2015 Graph widget is very slow when there is many datas, much, much slower than Winform version.

 

Is there a reason ?

Is there a solution ?

 

Thx.

0 Kudos
Message 1 of 2
(265 Views)

Hi Flow75,

 

Yes, WPF can sometimes be slower than WinForms for graphs due to rendering complexity and overhead.

 

I think this is mainly due to the rendering pipeline since WPF uses DirectX for rendering, while WinForms relies on GDI+. WPF is optimized for rich UI, animations, and vector graphics and not necessarily performance with massive data visualization unless specifically optimized.

 

But hopefully, there are some solutions and tips that involve reducing visual complexity, using lower-level rendering, or offloading to bitmap rendering for better performance.

 

You will find here a short list of possible optimizations:

  • Use virtualization: Ensure UI virtualization is enabled, especially if you're using controls like ItemsControl, ListBox, or DataGrid. However, virtualization may not apply out-of-the-box to graph widgets, so it’s not always a solution…
  • Use custom Drawing: Override rendering with lower-level DrawingVisual or DrawingContext instead of using higher-level WPF elements (like Ellipse, Line, etc. per point). This reduces the visual tree complexity drastically.
  • Use Bitmap Rendering: For extremely large datasets, consider rendering your graph to a WriteableBitmap or RenderTargetBitmap and displaying that instead of individual shapes.
  • Simplify Graph Visuals: Reduce node/edge styling complexity (no drop shadows, gradients,...) and use simplified shapes or drawing primitives.
  • Throttle or Sample Data: Don’t try to plot every single data point if it’s not necessary. And use data sampling or aggregation.
  • Update your Strategy: Only update the graph when needed, batch updates and use SuspendLayout-like logic if available.

Those are a few tricks to get better performances but there are indeed many others!

 

Hope it will help you,

 

Louis Zakarian

0 Kudos
Message 2 of 2
(234 Views)