how to improve wpf plot performance when need draw about 10000 Rectangles

Aug 15, 2012 at 9:33 AM

he everyone:

   i need draw 10000-20000 rectangles (color fill) in my wpf appliction (similar  pixel in bitmap ).

the app will became slow , there is a good solution  for draw-heavy  appliction.

i find oxyplotwpf render graphic in ShapesRenderContext, it perform well when  plot element

count is little,  i want to try use drawingRenderContex instead of shapsrenderContex, but i have not success. anyone can help me, thanks in advance

 

Aug 21, 2012 at 12:27 PM

I did not see any significant performance improvement in the DrawingRenderContext, so this code was just left there in case it should be reviewed again.

I guess you want to plot heat maps? I think it is necessary to support bitmaps in the IRenderContext to get good performance for those. See http://oxyplot.codeplex.com/workitem/9801

Aug 23, 2012 at 1:22 AM

very thank objo,

   your guess is exactly what i want to do, i recently study geogological map , i need fill many fill rectangles with color which represent lith info,   so  i need an way to quick draw , bitmap buffer(bitmap render) is an great idea,  but in wpf  i dont know how to implement ,  WriteableBitmap may help me .

Aug 23, 2012 at 7:53 AM

In WPF it should be easy to implement a heat map using BitmapSource.Create. I think this will have better performance than drawing on a WriteableBitmap. Create a 256-color palette and a pixel array (scaled to 8-bit) from your lithology data. Wrap the image in a WPF ScrollViewer and use a WPF scale transform if you want to zoom in/out!

http://msdn.microsoft.com/en-us/library/ms616045.aspx

Aug 23, 2012 at 10:37 AM

the problem now i face is i hope that i can using BitmapSource in oxyplot system,  using exist function of oxyplot,if i rewritte my code  without help of oxyplot ,it is very difficult for me , i have to  rewrite  coord tranform and many ether  function .

Aug 23, 2012 at 2:51 PM

I added http://oxyplot.codeplex.com/workitem/9985, you see there are some challenges related to the bitmap rendering there...