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

Oystein Bjorke 5 years ago 0
This discussion was imported from CodePlex

ProCodeMyth wrote at 2012-08-15 10:33:

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

 


objo wrote at 2012-08-21 13:27:

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


ProCodeMyth wrote at 2012-08-23 02:22:

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 .


objo wrote at 2012-08-23 08:53:

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


ProCodeMyth wrote at 2012-08-23 11:37:

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 .


objo wrote at 2012-08-23 15:51:

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

CodePlex