halfhp / androidplot

Charts and plots for Android
http://androidplot.com
Apache License 2.0
505 stars 159 forks source link

XYPlot in 1.5.7 doesn't show when swiping back in ViewPager2 #104

Closed yf13 closed 2 years ago

yf13 commented 3 years ago

I am trying to use XYPlot in a fragment managed by ViewPager2.

When set RenderMode to use background thread, I can see the charts only upon the first enter of the fragment. This means after swiping to another fragment and swipe back, the plots are empty. I have another TextView which is still visible.

Then when I changed the RenderMode to use main thread, I can see the XYPlot when swiping back to the containing fragment.

There is no crash or any logs.

halfhp commented 3 years ago

Hi @yf13 thanks for the bug report - would it be possible to get some sample code that triggers this issue?

tjohnn commented 3 years ago

@halfhp This is an issue with using androidplot in recyclerviews generally, I created a simple sample where I regenrated the issue https://github.com/tjohnn/androidplot-in-recyclerview-issue

halfhp commented 2 years ago

Fixed in this PR - Also added a recyclerview example to demonstrate usage.

Will be available in version 1.5.9.