halfhp / androidplot

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

Graph doesn't resize when layout size changes #73

Closed 195024 closed 6 years ago

195024 commented 6 years ago

I set an onTouchListener on the XYPlot to hide my LinearLayout with buttons (let's call it controlPanel) so there would be more space for the graph, but once the controlPanel is gone, the plot fills the new available height and yet the graph stays at the same size. Please look at the screens and you'll know what my issue is. I tried calling plot.redraw() and plot.getGraph.refreshLayout() after changing controlPanel's visibility but to no effect. The graph resizes itself correctly when I make the controlPanel gone and change orientation and viceversa (of course I'm saving the controlPanel's state to keep the visibility status). screenshot_20180221-115349 screenshot_20180221-115353

halfhp commented 6 years ago

Thanks for the report - I'm looking into this

halfhp commented 6 years ago

The fix will be going out with 1.5.4

195024 commented 6 years ago

Nice, when is the 1.5.4 coming out? I need this to work, Is there any temporary solution you could provide me with for now?

halfhp commented 6 years ago

Nice, when is the 1.5.4 coming out?

Should be available sometime tomorrow morning.

Is there any temporary solution you could provide me with for now?

You'd need to extend XYGraphWidget and then swap out the default instance with an instance of your implementation. If you look in XYGraphWidget.doOnDraw() there are a couple lines that init the gridRect and labelRect instances if null. Basically that needs to happen any time the dimensions of the passed in RectF change.

halfhp commented 6 years ago

1.5.4 has been pushed to maven central and should be available any time now.

195024 commented 6 years ago

Lovely, thanks for your hard work!