OxyPlot.Xamarin.Mac when use with dynamically created windows, windows disappeared.

DmitryMineevDmitryMineev USMember
edited May 2 in Xamarin.Mac

In the attachment I have project. There two types of using OxyPlot.Xamarin.Mac: with storyboard, and xib. When we crate new window with chart, and move chart, window disappeared. If work with window creating on starting application, this window work fine. How can I fix it?

Answers

  • FullEnglishFullEnglish GBMember ✭✭

    You'll need to do something like this. I use a function to clear the graph and then another to re-initialise each time...

            internal void CleanUp()
            {
                OxyPlotParent.Children.Clear();
    
                OxyPlotView = null;
                OxyPlotModel = null;
            }
    
    
    
            void InitGraph ()
            {
                OxyPlotView = new PlotView ();
    
                OxyPlotView.VerticalOptions = LayoutOptions.FillAndExpand;
                OxyPlotView.HorizontalOptions = LayoutOptions.FillAndExpand;
    
                OxyPlotModel = new PlotModel ();
            }
    
  • DmitryMineevDmitryMineev USMember

    @FullEnglish said:
    You'll need to do something like this. I use a function to clear the graph and then another to re-initialise each time...

          internal void CleanUp()
          {
              OxyPlotParent.Children.Clear();
    
              OxyPlotView = null;
              OxyPlotModel = null;
          }
    
    
    
          void InitGraph ()
          {
              OxyPlotView = new PlotView ();
    
              OxyPlotView.VerticalOptions = LayoutOptions.FillAndExpand;
              OxyPlotView.HorizontalOptions = LayoutOptions.FillAndExpand;
    
              OxyPlotModel = new PlotModel ();
          }
    

    Thank you for reply. But I am not understand how this can help me... Each time (when user click "Add chart") I create new instance of chart window, with new PlotView and new PlotModel. Where and how I can use CleanUp and InitGraph?

Sign In or Register to comment.