Forum Xamarin.Forms

Xamarin.Forms MicroCharts BarChart with Multiple Values

RajzerRajzer Member ✭✭

I'm using MicroCharts barChart:
I import everything.

I read a list of data from Api. I need to show the data grouped by parameter year(i read from every object from the list) and have 3 values for every year to show. Similar like this example:

Any suggestions?

Tagged:

Best Answers

Answers

  • RajzerRajzer Member ✭✭

    I imported everything get the data from the api, but not showing the true data

    private PlotView _opv = new PlotView();
    MessagingCenter.Subscribe<Object, BindingList

    >(this, "Sum", (args, list) =>
    {
    var plotModel = new PlotModel { Title = "OxyPlot Demo" };
    CategoryAxis xaxis = new CategoryAxis();
    xaxis.Position = OxyPlot.Axes.AxisPosition.Bottom;
    xaxis.MajorGridlineStyle = LineStyle.Solid;
    xaxis.MinorGridlineStyle = LineStyle.Dot;
    foreach (var el in list)
    {
    xaxis.Labels.Add(el.Year);
    ColumnSeries s = new ColumnSeries();
    s.IsStacked = false;
    s.Items.Add(new ColumnItem((double)el.Plus));
    s.Items.Add(new ColumnItem((double)el.Minus));
    s.Items.Add(new ColumnItem((double)el.Sum));

                    plotModel.Series.Add(s);
                    s.ClearSelection();
    
                }
                plotModel.Axes.Add(xaxis);
                plotModel.Axes.Add(new LinearAxis { Position = OxyPlot.Axes.AxisPosition.Left, Minimum = 0, Maximum = 10000000 });
    
                _opv.Model = plotModel;
            });
            Content = _opv;
    
  • RajzerRajzer Member ✭✭

    I dont know what is the problem

Sign In or Register to comment.