ComposeCharts is a high-performance, declarative, and cross-platform chart library built with Jetpack Compose Multiplatform. It re-imagines the feature set of the classic MPAndroidChart with modern Compose declarative APIs, GPU-accelerated Skia rendering, and reactive state management.
- Features: Cubic Bezier smoothing (
isCubic), vertical gradient area fills (fillBrush), data point circle indicators, crosshair touch highlighting, and centroid-focused pinch-to-zoom.
- Features: Single bars, grouped comparison bars, multi-segment stacked bars (
yValues: FloatArray), rounded bar corners, value text labels, and MarkerView tooltip popups.
- Features: Solid pie and Donut hole rendering (
holeRadiusRatio), seamless zero-gap slice drawing, touch slice selection withselectionShiftoffset animations, and calibrated 12 o'clock top angle alignment.
- Features: Financial-grade Open-High-Low-Close (OHLC) candles, high/low shadow lines, customizable increasing/decreasing colors, and smooth high-volume scrolling with strict viewport clipping.
- Features: Polar coordinate polygon web lines, multi-dataset polygon overlays with alpha blending, and attribute score MarkerView tooltips.
- Strict Viewport Boundary Constraints (
ViewportHandler.kt):- Enforces viewport boundaries (
constrainTranslation()) so that zooming and drag-panning operations never allow chart contents to fly off-screen or leave empty whitespace.
- Enforces viewport boundaries (
- MarkerView & Tooltip System (
MarkerView.kt):- Interactive floating card popups positioned above tapped data points with edge-avoidance logic.
- Dynamic Legend System (
Legend.kt):- Draws dataset color keys and labels automatically below the chart.
- Cross-Platform Navigation (
BackHandler):- Supports native system back gestures (Android
BackHandler) and edge swipe-to-back gestures.
- Supports native system back gestures (Android
val entries = listOf(
Entry(0f, 10f),
Entry(1f, 80f),
Entry(2f, 45f),
Entry(3f, 100f)
)
val dataSet = LineDataSet("My Data", entries).apply {
color = Color(0xFF00ADB5)
drawFilled = true
isCubic = true // Smooth Bezier curve
}
LineChart(
dataSets = listOf(dataSet),
modifier = Modifier.fillMaxWidth().height(300.dp)
)cd "ComposeCharts"./gradlew :composeApp:installDebug./gradlew :composeApp:compileKotlinIosSimulatorArm64ComposeCharts/
├── composeApp/ # Shared module & target integrations
│ ├── src/
│ │ ├── commonMain/kotlin/ # Shared components & charts
│ │ │ └── com/charts/compose/
│ │ │ ├── App.kt # Navigation coordinator
│ │ │ ├── core/ # ViewportHandler, Axis, Legend, MarkerView, Gestures
│ │ │ ├── data/ # Entry, BarEntry, PieEntry, CandleEntry, RadarEntry, DataSet
│ │ │ ├── charts/ # LineChart, BarChart, PieChart, CandleStickChart, RadarChart
│ │ │ └── screens/ # Demo showcase screens
│ │ ├── androidMain/ # Android entry & BackHandler
│ │ └── iosMain/ # iOS entry & BackHandler
│ └── build.gradle.kts # Module build settings
├── settings.gradle.kts # Settings config
├── .gitignore # Git ignore rules
└── build.gradle.kts # Root build settings
This project is licensed under the MIT License - see the LICENSE file for details.
Copyright (c) 2026 Yangcy Zhang




