Introduction
Displaying charts in mobile apps has always been a great way to offer users a clear overview of numerical data. I want this task to be as easy as writing a few lines of code, but I couldn't find a straightforward way to achieve this. This is why I started exploring SkiaSharp and created Microcharts.
NuGet package: Xamarin.Forms = search "Microcharts.Forms"
This simple plugin can display microcharts in Xamarin.Forms.

Available charts Microcharts.Forms Plugin
- Barchart
- PointChart
- LineChart
- DonutChart
- RadialGaugeChart
- RadarChart
Chart Types
BarChart
Chartview.Chart = new BarChart()
{
Entries = entries
};

PointChart
Chartview.Chart = new PointChart
{
Entries = entries
};

LineChart
Chartview.Chart = new LineChart
{
Entries = entries
};

DonutChart
Chartview.Chart = new DonutChart()
{
Entries = entries
};

RadialGaugeChart
Chartview.Chart = new RadialGaugeChart()
{
Entries = entries
};

RadarChart
Chartview.Chart = new RadarChart
{
Entries = entries
};

Step 1. You can create Xamarin.Forms app by going to File >> New >> Visual C# >> Cross Platform >> Cross Platform App (Xamarin.Native or Xamarin.Forms), give the application name, and press OK.
(Project name: MicrochartsApp)
Step 2. Now, add the following NuGet Package for your projects.
Microcharts.Forms
For that, go to Solution Explorer and select your solution. Right-click and select "Manage NuGet Packages for the Solution". Now, select the following NuGet Package, select your project, and install it.
Microcharts.Forms

Step 3. To display a chart, we'll need to host it in a ChartView.
After installing NuGet packages, add a ChartView control to your project. For that, go to Solution Explorer >> MicrochartsApp(PCL) >>> Double-click on MainPage.xaml. After opening this, you can add assembly and XAML code to your project. Here is the code for this page.
Assembly
xmlns:forms="clr-namespace:Microcharts.Forms;assembly=Microcharts.Forms"
XAML code
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MicrochartsApp"
x:Class="MicrochartsApp.MainPage"
xmlns:forms="clr-namespace:Microcharts.Forms;assembly=Microcharts.Forms">
<ScrollView>
<StackLayout Orientation="Vertical">
<forms:ChartView x:Name="Chart1" HeightRequest="150"/>
<forms:ChartView x:Name="Chart2" HeightRequest="150"/>
<forms:ChartView x:Name="Chart3" HeightRequest="150"/>
<forms:ChartView x:Name="Chart4" HeightRequest="150"/>
<forms:ChartView x:Name="Chart5" HeightRequest="150"/>
<forms:ChartView x:Name="Chart6" HeightRequest="160"/>
</StackLayout>
</ScrollView>
</ContentPage>

Step 4. In this step, add data entries. For that, open Solution Explorer >> MicrochartsApp(PCL) >>click open MainPage.xaml.cs. This class code is given below.
Every chart is displayed via Microcharts and consumes a set of data entries. They will always have the same structure regardless of the chart type that you want to display.
Each entry
- A floating number representing its value is required.
- Label: what your entry is associated with.
- ValueLabel: format your value
- Color: entry
using Microcharts;
using SkiaSharp;
using Microcharts.Forms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Entry = Microcharts.Entry;
namespace MicrochartsApp
{
public partial class MainPage : ContentPage
{
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 = "October",
ValueLabel = "-100"
},
};
public MainPage()
{
InitializeComponent();
Chart1.Chart = new RadialGaugeChart() { Entries = entries };
Chart2.Chart = new LineChart() { Entries = entries };
Chart3.Chart = new DonutChart() { Entries = entries };
Chart4.Chart = new BarChart() { Entries = entries };
Chart5.Chart = new PointChart() { Entries = entries };
//Chart6.Chart = new RadarChart() { Entries = entries };
}
}
}

Step 5. Now, go to the "Build" menu and configure your startup project. After configuring, run your project. You will have the result below.

Finally, we have successfully created Xamarin.Forms Microcharts application.

Jyoti KushvahaPosted Jun 20, 2022, 7:36 AM
How to implement full stack bar chart in uwp?
Melinda KhinPosted Apr 23, 2022, 7:05 AM
How to chart data dynamically from the local sqlite-pcl-net database?
vasanth PPosted Feb 26, 2020, 7:30 AM
Any one share Dynamic Data Binding with MircoChart is very helpful for me
Robert NewmanPosted Sep 7, 2019, 5:20 AM
Is there option to add valuelabel on left or right of line chart
ousainou ceesayPosted Sep 5, 2019, 2:09 PM
My errors are : Error CS0234 The type or namespace name 'Entry' does not exist in the namespace 'Microcharts' (are you missing an assembly reference?) 2. Severity Code Description Project Line Suppression StateError CS0012 The type 'Chart' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microcharts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
florent SERFASPosted May 31, 2019, 5:13 AM
Hi all, is it possible with microchart to do a real time chart ?
divya morampudiPosted Feb 13, 2019, 5:46 AM
Hi all,how to get label value by clicking on that.i mean do we have any click event for label?.i need to navigate to another page when i click on that valuelabel
Ajithkumar JPosted Jan 14, 2019, 7:41 AM
Copied from https://www.youtube.com/watch?v=tmymWdmf1y4&list=PLpbcUe4chE794tJySgk0EiqSWp4o2yFdY&index=6 :)
satya mPosted Jan 4, 2019, 3:57 AM
Is it possible in Visual studio 2017 professional
Terry ChenPosted Dec 5, 2018, 4:18 PM
Hi, can this charts do live updates?
SHRUTI SHARMAPosted Aug 22, 2018, 7:04 PM
I did try already, but this didnt work buddy
SHRUTI SHARMAPosted Aug 21, 2018, 1:15 PM
Hi can you let us know how to reduce diameter of pie chart
Maitri PalkhiwalaPosted Aug 21, 2018, 6:12 AM
Hi, Can u pls suggest how to implement two bar chart?
Sandeep KumarPosted Dec 25, 2017, 10:32 AM
Hi, Can u explain how to implement tap event in microcharts and how to work with dynamic data too
Ravishankar VelladuraiPosted Dec 11, 2017, 10:07 PM
Wow nice article bro..