oxyplot icon indicating copy to clipboard operation
oxyplot copied to clipboard

Moving annotation is slow

Open tesar-tech opened this issue 5 years ago • 7 comments

I am moving with annotation based on the slider value: As you can see, it is super slow and laggy. Blue line is the annotation, it should follow the mouse.

f8db250c-2449-4795-b64d-1d2eb866c0c5

Steps to reproduce

Full UWP project with issue is here.

  1. Move with annotation on plot multiple times:
annotation.X = e.NewValue;//value from slider
annotation.PlotModel.InvalidatePlot(false);

Platform:

UWP SDK for 1903

Expected behaviour

It should be smooth. In presented project there are multiple plots and step frequency is set to .001. So a lot of changes. But even with single plot annotation isn't smooth enough...

Actual behaviour

Moving annotation is slow. If I move some element (let say button) by changing margin it is smoother.

tesar-tech avatar Mar 25 '20 15:03 tesar-tech

Oxyplot always redraws the whole plot, even if only one single component changed. So depending on how complex your plot is this can take between 'very short' a 'a long time'. Do I understand correctly that you try to update the plot every millisecond? Have you tried to increase this value to, say, 100ms?

Jonarw avatar Mar 27 '20 11:03 Jonarw

@Jonarw Yes I tried, and it's naturally better, but doesn't solve my real scenario (this is just demonstration of my issue).

So there is no way how to redraw just the annotation?

tesar-tech avatar Mar 27 '20 16:03 tesar-tech

This is a limitation in this multi-platform & general purpose library. I think the architecture needs to be changed to support partial redraws...

objorke avatar Apr 08 '20 08:04 objorke

I moved the invalidation to timer tick, so it doesn't slow down the slider. And now it's kind of bearable... d2f230ff-78c5-468e-8ee7-1741aab56e33

(full code in linked repo)

tesar-tech avatar Apr 19 '20 08:04 tesar-tech

how to solve this problem?

dlgcy avatar Jun 28 '21 01:06 dlgcy

@dlgcy there is no solution. As @objorke said, the architecture of OxyPlot does not lend itself to incremental updates, and no work has been done to facilitate partial redraws. The OverlayDemo in the WpfExamples project shows how you can use the UI library to present additional graphics outside of OxyPlot pipeline, which may be an option depending on the platform.

VisualMelon avatar Jun 28 '21 09:06 VisualMelon

缓解方案

dlgcy avatar Jul 02 '21 02:07 dlgcy