38,185
stars
+-1
8,963
forks
1,085
watchers
517
prs
4,965
issues
48
releases
0
discussions
README
!MPAndroidChart
The charting library Android has relied on since 2014, rewritten from the ground up in Kotlin. Nine chart types, a Jetpack Compose module and a property based API, with zooming, dragging, highlighting, markers, animations and styling control over every pixel. Thirty thousand points stay smooth, one dependency line gets you started, and 35 chapters of guides cover the rest.
Charts is the iOS version of this library.
Support the project
Support the project by downloading my other apps and leaving a rating, such as Sightline, a fast screenshot and screen recording tool for macOS with one editor for pictures and clips, scrolling capture, text recognition and a built in MCP server for AI agents. All my apps and projects are on philjay.cc.
If this library helps you, you can also support it by sponsoring me on GitHub or with a donation.
Gallery
The example app opens with every chart type in one consistent style, in a dark and a light variant, drawn by the library. The styling code is in MPChartExample/src/main/kotlin/com/xxmassdeveloper/mpchartexample/design/.
!Every chart type, dark
Watch the overview: twenty two seconds through the chart types, the styling, thirty thousand points and the code it takes.
!Every chart type, light
Documentation
The guides at philjay.cc cover the library in 35 chapters, from a first chart to theming, Compose, custom renderers and troubleshooting. Every class, function and property also has KDoc, and the generated API reference is served by JitPack for each release: MPChartLib and MPChartCompose. To build it locally run ./gradlew dokkaGenerate and open build/dokka/html/index.html.
Requirements
minSdk 23, compileSdk 35, Java 17 and Kotlin 2.0 or newer. The Compose module needs compileSdk 37, because Compose itself does. Java callers need no Kotlin at all. Coming from the Java 3.x versions? Read MIGRATION.md or the longer migration guide. CHANGELOG.md lists what changed in 4.0.
Install
4.0 is a rewrite in Kotlin. Its coordinates differ from 3.x, so a project on the 3.x coordinates com.github.PhilJay:MPAndroidChart keeps building untouched. Pin the version, do not track the newest one.
kotlin
// settings.gradle.kts
dependencyResolutionManagement {
repositories {
maven("https://jitpack.io")
}
}
// build.gradle.kts
dependencies {
implementation("com.github.PhilJay.MPAndroidChart:MPChartLib:v4.0.1")
implementation("com.github.PhilJay.MPAndroidChart:MPChartCompose:v4.0.1") // only for Compose
}
Quick start with Compose
Every chart type has a composable with the same name. Pass data as state, configure the view once in setup, and read selection and viewport back through the state:
kotlin
val state = rememberChartState()
LaunchedEffect(lineData) { state.animateX(500) }
LineChart(
data = lineData,
modifier = Modifier.fillMaxWidth().height(300.dp),
state = state,
marker = { entry, _ - Text("${entry.y}") },
setup = {
description.isEnabTop issues
Latest release
MPAndroidChart 4.0.1 v4.0.1 2026-09-28Fixes and small additions for MPAndroidChart 4.0. A drop-in update from 4.0.0: no API was removed or changed.
kotlin
implementation("com.github.PhilJay.MPAndroidChart:MPChartLib:v4.0.1")
implementation("com.github.PhilJay.MPAndroidChart:MPChartCompose:v4.0.1") // only for Compose
Fixed
- A tap inside a bar of a combined chart selects the bar instead of a nearby line point (5207).
- In a bar chart whose grouped data sets use different y axes, a tap selects the bar that was touched (5292).
- Limit line labels at the edge of the content area are no longer cut off (5328).
- Auto scaling also