oxyplot-xamarin
oxyplot-xamarin copied to clipboard
Setting up chart while invisible does not render when become visible
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?
yes, it should work like that. this must be a bug. What platform are you running on? iOS, Android, UWP, WinPhone?
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.
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.
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?