Xamarin.Forms MicroCharts how to add multiple values to Label

2020-02-27 xamarin xamarin.forms xamarin.android xamarin.ios

I'm following the starting code from the GitHub about micro charts with my data I read from API:

    List<Entry> entries = new List<Entry>  
        {  
            new Entry(200)  
            {  
                Color=SKColor.Parse("#FF1943"),  
                Label ="January",  
                ValueLabel = "200"  
            },  
            new Entry(400)  
            {  
                Color = SKColor.Parse("00BFFF"),  
                Label = "March",  
                ValueLabel = "400"  
            },  
            new Entry(-100)  
            {  
                Color =  SKColor.Parse("#00CED1"),  
                Label = "Octobar",  
                ValueLabel = "-100"  
            },  
            };  

Is it possible to add 2-3 values in ValueLabel? I'm trying to make a simulation of bar chart multiple series

Answers

Based on my test, I could not add multiple Series via MicroCharts BarChart. You could use OxyPlot.

Follow the code in this link. Bar/Linear chart with multiple entries in Xamarin Forms

Install the OxyPlot.Xamarin.Forms from NuGet Package Manager.

Add the code below to MainActivity.cs

OxyPlot.Xamarin.Forms.Platform.Android.PlotViewRenderer.Init();

enter image description here

You could download the source from the link below. https://forums.xamarin.com/discussion/comment/402658#Comment_402658

Related