MPAndroidChart 3.1.0.1

dotnet add package MPAndroidChart --version 3.1.0.1
                    
NuGet\Install-Package MPAndroidChart -Version 3.1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MPAndroidChart" Version="3.1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MPAndroidChart" Version="3.1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="MPAndroidChart" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MPAndroidChart --version 3.1.0.1
                    
#r "nuget: MPAndroidChart, 3.1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MPAndroidChart@3.1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MPAndroidChart&version=3.1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=MPAndroidChart&version=3.1.0.1
                    
Install as a Cake Tool

MPAndroidChart for .NET Android

A .NET for Android binding of MPAndroidChart by Philipp Jahoda: line, bar, horizontal bar, pie, scatter, candlestick, bubble, radar and combined charts with scaling, dragging, animations, highlighting, custom formatters and markers.

Binding by Lucas Teixeira. Source and issues: https://github.com/Flash3001/MPAndroidChart.Xamarin

Version 3.1.0.1

  • Targets net10.0-android (.NET 10). Minimum Android API 21. No package dependencies.
  • Binds MPAndroidChart master @ 9c7275a0 (5 June 2025). Upstream has not tagged a release since v3.1.0 (April 2019); this build carries the 63 commits made after it: Fill gradients for bars, pie highlight color, min/max axis label counts, dataIndex highlighting for combined charts, ApproximatorN, the restored IValueFormatter / IAxisValueFormatter interfaces and a number of bug fixes. Upstream diff: https://github.com/PhilJay/MPAndroidChart/compare/v3.1.0...9c7275a0
  • IntelliSense comes from the library's Javadoc.

Looking for Xamarin.Android (MonoAndroid)? Use package 3.1.0.

Install

dotnet add package MPAndroidChart
<PackageReference Include="MPAndroidChart" Version="3.1.0.1" />

Quick start

Layouts keep the Java class names:

<com.github.mikephil.charting.charts.LineChart
    android:id="@+id/chart"
    android:layout_width="match_parent"
    android:layout_height="300dp" />

The Java packages com.github.mikephil.charting.* become the MikePhil.Charting.* namespaces (Charts, Data, Components, Formatter, Listener, Highlight, Util, Interfaces.Datasets, …).

using MikePhil.Charting.Charts;
using MikePhil.Charting.Components;
using MikePhil.Charting.Data;
using MikePhil.Charting.Formatter;
using MikePhil.Charting.Highlight;
using MikePhil.Charting.Listener;
using MikePhil.Charting.Util;

var chart = FindViewById<LineChart>(Resource.Id.chart)!;

var entries = Enumerable.Range(0, 12)
    .Select(i => new Entry(i, (float)(Math.Sin(i) * 10 + 20)))
    .ToList();

var set = new LineDataSet(entries, "sin") { LineWidth = 2f, ValueFormatter = new TwoDecimals() };
set.SetMode(LineDataSet.Mode.CubicBezier);
set.SetColors(ColorTemplate.MaterialColors.ToArray());
set.SetDrawFilled(true);

chart.Data = new LineData(set);
chart.XAxis.ValueFormatter = new IndexAxisValueFormatter(new[] { "Jan", "Feb", "Mar", "Apr" });
chart.Description.Text = "";
chart.SetOnChartValueSelectedListener(new Selection());
chart.AnimateX(800);

// Formatters and listeners are Java interfaces: implement them on a Java.Lang.Object subclass.
sealed class TwoDecimals : Java.Lang.Object, IValueFormatter
{
    public string GetFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler vph)
        => value.ToString("0.00");
}

sealed class Selection : Java.Lang.Object, IOnChartValueSelectedListenerSupport
{
    public void OnValueSelected(Entry e, Highlight h) { /* e.GetX(), e.GetY(), h.DataSetIndex */ }
    public void OnNothingSelected() { }
}

Bar charts with solid or gradient fills:

var bars = new BarDataSet(barEntries, "bars")
{
    Fills = new List<Fill> { new Fill(Color.Red.ToArgb(), Color.Blue.ToArgb()), new Fill(Color.Green.ToArgb()) },
};
barChart.Data = new BarData(bars);

The MPAndroidChart wiki applies as is, with C# casing: https://github.com/PhilJay/MPAndroidChart/wiki

Upgrading from 3.1.0

The API differences are upstream's. The ones you are most likely to hit:

3.1.0 3.1.0.1
ValueFormatter abstract class (GetFormattedValue(float), GetAxisLabel, GetBarLabel, GetPieLabel, …) Removed. Implement IValueFormatter.GetFormattedValue(float, Entry, int, ViewPortHandler) or IAxisValueFormatter.GetFormattedValue(float, AxisBase) on a Java.Lang.Object subclass.
PercentFormatter(PieChart) PercentFormatter() or PercentFormatter(DecimalFormat)
GradientColor, BaseDataSet.GradientColor / GradientColors Fill (MikePhil.Charting.Util), BarDataSet.Fills. SetGradientColor(start, end) still works.
DataSet.Values DataSet.Entries (Values remains as a deprecated alias)
DataRenderer.DrawValue(Canvas, string, float, float, int) DrawValue(Canvas, IValueFormatter, float, Entry, int, float, float, int)

New: AxisBase.AxisMinLabels / AxisMaxLabels, YAxis.LabelXOffset, Chart.SetNoDataTextAlignment, BarLineChartBase.SetClipDataToContent, PieDataSet.HighlightColor, Chart.HighlightValue(x, dataSetIndex, dataIndex).

License

Apache License 2.0. Copyright 2016-2026 Lucas Teixeira & Philipp Jahoda.

Product Compatible and additional computed target framework versions.
.NET net10.0-android36.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0-android36.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on MPAndroidChart:

Package Downloads
UltimateXF

A powerful Android/iOS chart view / graph view library, binding support for Xamarin.Forms, supporting line- bar- pie- radar- bubble- and candlestick charts as well as scaling, dragging and animations.

SCV.XControls

Librería que contiene controles básicos para el desarrollo de apps con Xamarin.Forms, Xamarin.Android y WPF

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on MPAndroidChart:

Repository Stars
bulubuloa/Ultimate-Xamarin-Forms-KIT
A powerful 🚀 Android/iOS chart view / graph view library, binding support for Xamarin.Forms, supporting line- bar- pie- radar- bubble- and candlestick charts as well as scaling, dragging and animations.
Version Downloads Last Updated
3.1.0.1 137 9/15/2026
3.1.0 97,909 9/14/2020
3.1.0-alpha 1,968 6/18/2020
3.0.3 82,147 9/3/2018
3.0.2 64,249 3/31/2017
3.0.1.1 2,838 3/16/2017
3.0.1 3,230 11/24/2016
3.0.0 2,998 10/19/2016
3.0.0-beta11 2,472 8/2/2016
3.0.0-beta1 2,108 7/21/2016
2.2.5 4,680 7/20/2016
2.2.3.2 2,395 3/30/2016
2.1.4 2,891 9/29/2015
2.1.1 2,188 9/18/2015

MPAndroidChart master @ 9c7275a0 (2025-06-05), the 63 commits after v3.1.0 (Fill/gradients, IValueFormatter restored, bug fixes). .NET 10 / net10.0-android. Changes: https://github.com/PhilJay/MPAndroidChart/compare/v3.1.0...9c7275a0