oxyplot-xamarin icon indicating copy to clipboard operation
oxyplot-xamarin copied to clipboard

Setting up chart while invisible does not render when become visible

Open scastria opened this issue 9 years ago • 4 comments
trafficstars

I have a page that shows either a chart or a spreadsheet view. The user can toggle between the two which just sets the chart visible and spreadsheet invisible or vice versa. When the Xamarin.Forms page is first constructed and the chart plot model is built with LineSeries and stuff, everything works as long as the page is in chart mode with the chart being visible. However, if the page is constructed while in spreadsheet mode, everything is the same as far as the chart goes and the building of the plot model, EXCEPT, the chart is invisible at the time. Therefore, when the user toggles back to chart mode, the chart is blank.

I am guessing that the rendering logic of oxyplot detects that the chart is invisible so it doesn't actually draw anything. However, if it is going to be smart like that, I would also expect it to detect that the chart was just made visible and render the chart.

Am I correct on my assumptions?

scastria avatar Oct 11 '16 18:10 scastria

yes, it should work like that. this must be a bug. What platform are you running on? iOS, Android, UWP, WinPhone?

objorke avatar Oct 11 '16 21:10 objorke

ios has the issue. I just checked Android and it works correctly. FYI: I am NOT directly setting IsVisible on the chart itself, but a parent view that contains the chart. Not sure if that helps you.

scastria avatar Oct 11 '16 21:10 scastria

Hello @scastria its old thread and i am sure its too late , but i was able to solve it with PlotModel.InvalidatePlot(true); after setting isVisible to true.

mahesh139 avatar Sep 15 '17 17:09 mahesh139

I have the same issue on iOS. Android and UWP do this fine. I'm also setting the parent view visible and then I render the chart. Result: nothing happens. Invalidating the plot doesn't do anything as well in this case. Any solutions?

myllen avatar Sep 10 '20 10:09 myllen