oxyplot / oxyplot-xamarin

OxyPlot for Xamarin.Mac and Xamarin.Forms
MIT License
64 stars 59 forks source link

OxyPlot.Xamarin.Forms v1.0.0 Zoom and pan only work in debug #146

Open drormekorot opened 1 year ago

drormekorot commented 1 year ago

I'm using OxyPlot.Xamarin.Forms v1.0.0 via NuGet.

I'm displaying a linear graph and it works great along with zoom and pan, as long as I am in debug. As soon as I switch to release, the graph appears but both zoom and pan do not respond.

This occurs only on Android, on iOS zoom and pan work in release.

My guess is that PlotController is being dropped by the linker, since I did have some issues with it in the past with db classes. Is there anything that should be added to OnCreate other than OxyPlot.Xamarin.Forms.Platform.Android.PlotViewRenderer.Init(); to force the linker to keep all of OxyPlot's source code?

janusw commented 1 year ago

I'm using OxyPlot.Xamarin.Forms v1.0.0 via NuGet.

Note that 1.0.0 is 6 years old by now. I don't think we'll fix any bugs for that version any more. Sorry!

Is there any reason why you can't use version 2.0.0 or 2.1.0? If not, please try 2.1.0, which is the latest released version, and tell us if the problem also exists there.

drormekorot commented 1 year ago

Interestingly enough, I did start the development with 2.1.0, but zoom and pan do not respond at all on the latest version. Both in debug and release.

I found https://stackoverflow.com/questions/61436606/oxyplot-xamarin-forms-pinch-zoom-and-panning-not-working-for-linear-series that suggested using v1.0.0, so that is why I reverted.

The graph does appear on both versions.

I will be happy to try and solve this issue on 2.1.0, please let me know what other information I can provide.

janusw commented 1 year ago

Alright, thanks for the feedback. Apparently this is related to issue #62.

If it was working (partly) with 1.0.0, but not with 2.1.0, we can hopefully find out when and how it broke.

As an additional data point, could you maybe check if zoom/pan works with version 2.0.0 on Android?

VisualMelon commented 1 year ago

We based the Avalonia touch-input work on Xamarin, so may be some clues in what we had to change for that: https://github.com/oxyplot/oxyplot-avalonia/commit/a067e00337d7b721ecbf226d7f85a882b65cfba9 (can't find the discussion around that commit, unfortunately)

If PlotController is lost then all interaction should fail; you could try creating your own PlotController to be bound to the Plot/PlotView - which should ensure it survives the linker - to see if that changes the behaviour at all.

Does the tracker work in 2.1.0?

drormekorot commented 1 year ago

I checked v2.0.0 on Android, graph is displayed but zoom/pan do not respond

The issue is not related to the linker on 2.1.0 as zoom and pan do not respond on debug, which does not use the linker. I do not see any interaction when interacting with the graph, no tracker, no pinch, no drag.

Please let me know what you require in order to investigate this further, I'll be happy to provide

drormekorot commented 1 year ago

Just checked with iOS, zoom and pan do not respond on 2.0.0 and 2.1.0.

To summarize:

iOS zoom+pan respond on 1.0.0, both debug and release Android zoom+pan respond on 1.0.0 debug only.

2.0.0 and 2.1.0, zoom+pan do not respond on iOS and Android

Let me know what you need in order to investigate it.

drormekorot commented 1 year ago

@janusw any way I can help move this forward?

IosDeveloperHarsh commented 1 year ago

Any update on this ticket as Zoom and Pan is not working in the 2.1.0 version