FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Bar chart inside a ListView control · Issue #60 · oxyplot/oxyplot-xamarin · GitHub

Repository navigation

Bar chart inside a ListView control #60

Description

Steps to reproduce

  1. Add a ListView to your ContentPage.
  2. Create a list of PlotModels to your page for binding to the ListView.
  3. Now use a Template/ ViewCell having PlotView to the ListView.

Platform: Xamarin Forms (Cross-Platform)
.NET version: 4.0

Expected behaviour

While loading the ContentPage, the ListView should load the data based on the PlotModels provided.

Actual behaviour

Everything is running smooth in Android. But the problem is I am getting a error "PlotModel is already in use by some other PlotView control" when I am trying to run it on IPhone.

//My content page
public MyConstructor()
{
	List<MyChart> charts = new List<MyChart>();
	charts.Add(new MyChart { PlotModel = PlotModel1 });
	charts.Add(new MyChart { PlotModel = PlotModel2 });
	charts.Add(new MyChart { PlotModel = PlotModel3 });
	charts.Add(new MyChart { PlotModel = PlotModel4 });
	ListView lvPlots = new ListView(ListViewCachingStrategy.RetainElement)
	{
		ItemsSource = charts,
		ItemTemplate = new DataTemplate(typeof(NewDashboardSubCell)),
		HasUnevenRows = true
	};
	Content = lvPlots;
}

public class MyChart
{
       public MyPlotModel PlotModel { get; set; }
}


//My View Cell

public class NewDashboardSubCell : ViewCell
{
        PlotView plotView;
        public NewDashboardSubCell()
        {
            try
            {
                plotView = new PlotView
                {
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions = LayoutOptions.FillAndExpand,
                    IsVisible = true,
                    IsEnabled = true,
                    HeightRequest = App.ScreenHeight - 100,
                    WidthRequest = App.ScreenWidth - 40
                };

                plotView.SetBinding(PlotView.ModelProperty, "PlotModel");

                View = plotView;                
            }
            catch (Exception ex)
            {
            }
	}
}

Code.txt

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL