简体   繁体   中英

Xamarin.Forms MicroCharts how to add multiple values to Label

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

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();

在此处输入图片说明

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM