RefreshPlot slows down WPF

Oct 4, 2013 at 10:52 AM
If I do have a huge number of datapoints within my lineseries, my wpf application becomes really slow.

I implemented the taskdemo from the source. There the maxpoint values was set to 20000. If I increase that number to 50000, the wpf application is not useable anymore once the RefreshPlot is called from within an update task (for about 50000 points).

Is there a way to solve this or is there a maximum of points you should draw within the plot?

Cheers mike
Oct 4, 2013 at 2:10 PM
Oct 4, 2013 at 3:34 PM
This solution is not really clear to me as I am new to OxyPlot.

By drawing dashed lines instead of filled ones I could gain performance. Is this right?

What about this "BalancedLineDrawingThicknessLimit" property?

A little idea how to use it would be great.

Thanks in advance,

mike
Coordinator
Oct 6, 2013 at 5:35 PM
We did some recent improvements to the performance on WPF, but WPF's rendering core is still a bottleneck.
I think we can do more of the updates in a background thread to improve responsiveness on the UI thread, but I have not tested this yet.
See also performance tips on https://oxyplot.codeplex.com/wikipage?title=Performance
Oct 25, 2013 at 12:53 PM
objo wrote:
We did some recent improvements to the performance on WPF, but WPF's rendering core is still a bottleneck.
I think we can do more of the updates in a background thread to improve responsiveness on the UI thread, but I have not tested this yet.
See also performance tips on https://oxyplot.codeplex.com/wikipage?title=Performance
Currently, the Update(bool updateData) method in OxyPlot/PlotModel/PlotModel.cs, is all happening on the UI thread? I am using OxyPlot in WPF and after calling InvalidatePlot, at which point I am running in another thread, as soon as Invoke() with InvalidateArrange (or something like that) gets called, its moves back onto the UI thread for the actual update of the PlotModel. Have you any code which does this on a background thread? When I try and do it i'm running into errors because the plot object belongs to another thread.

This is really affecting the performance of my app and am going to have to fundamentally change the way I draw my graphs soon if I can not solve the issue. I already am using OxyPlot purely for the Axis and rendering the plot contents myself and using the Annotation series to show the bitmap I create.
Oct 25, 2013 at 2:36 PM
Your Examples are also the same. The demo 'Refresh by calling RefreshPlot on the PlotModel from a non-UI Thread' just calls refreshPlot in a separate thread, but all the updating gets pushed to the Main Thread...
Oct 28, 2013 at 9:18 AM
Is there nothing I can do about this objo?
Nov 11, 2013 at 9:28 AM
Any ideas of what could be moved to a background thread?
Nov 11, 2013 at 4:06 PM
I have moved the part of the Render function (I'm only concentrating on Scatter Series at the moment as that is all i'm using) which converts the points to screen co-ordinates successfully to another thread and this works. However, still the DrawMarkers functions are what is causing the freeze as they are writing directly to the canvas.

Do you think implementing a 'double canvas' where the entire canvas is drawn and then sent to the screen, rather than each point in turn? This would sort of be like a Windows Forms 'double buffer'?
Coordinator
Nov 11, 2013 at 6:34 PM
I tried to make a small prototype using a scheduler from the UI thread's synchronization context, but could not get around blocking the UI thread while populating the canvas. Try stack overflow, I am sure someone knows if this is possible or not!