RefreshPlot slows down WPF

Oystein Bjorke 5 ár síðan 0
This discussion was imported from CodePlex

user78483 wrote at 2013-10-04 12:52:

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

everytimer wrote at 2013-10-04 16:10:


user78483 wrote at 2013-10-04 17:34:

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

objo wrote at 2013-10-06 19:35:

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

willmoore88 wrote at 2013-10-25 14:53:

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.

willmoore88 wrote at 2013-10-25 16:36:

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...

willmoore88 wrote at 2013-10-28 10:18:

Is there nothing I can do about this objo?

willmoore88 wrote at 2013-11-11 10:28:

Any ideas of what could be moved to a background thread?

willmoore88 wrote at 2013-11-11 17:06:

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'?

objo wrote at 2013-11-11 19:34:

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!
CodePlex