Simple Jetpack Compose Charts for multi-platform. Including Android, Web, Desktop.

Overview

compose-charts

GitHub latest commit GitHub contributors GitHub issues Open Source? Yes! GitHub forks GitHub stars GitHub watchers

Simple Jetpack Compose Charts for multi-platform. Including Android, Web, Desktop.

Graph Effects

How to use?

1, show Pie Chart in Jetpack Compose:

@Composable
fun PieChartView() {
    PieChart(
        pieChartData = PieChartData(
            slices = listOf(
                PieChartData.Slice(
                    randomLength(),
                    randomColor()
                ),
                PieChartData.Slice(randomLength(), randomColor()),
                PieChartData.Slice(randomLength(), randomColor())
            )
        ),
        // Optional properties.
        modifier = Modifier.fillMaxSize(),
        animation = simpleChartAnimation(),
        sliceDrawer = SimpleSliceDrawer()
    )
}

2, show Line Chart in Jetpack Compose:

@Composable
fun LineChartView() {
    LineChart(
        lineChartData = LineChartData(
            points = listOf(
                Point(randomYValue(), "Line 1"),
                Point(randomYValue(), "Line 2"),
                Point(randomYValue(), "Line 3"),
                Point(randomYValue(), "Line 4"),
                Point(randomYValue(), "Line 5"),
                Point(randomYValue(), "Line 6"),
                Point(randomYValue(), "Line 7")
            )
        ),
        // Optional properties.
        modifier = Modifier.fillMaxSize(),
        animation = simpleChartAnimation(),
        pointDrawer = FilledCircularPointDrawer(),
        lineDrawer = SolidLineDrawer(),
        xAxisDrawer = SimpleXAxisDrawer(),
        yAxisDrawer = SimpleYAxisDrawer(),
        horizontalOffset = 5f
    )
}

3, show Bar Chart in Jetpack Compose:

@Composable
fun BarChartView() {
    BarChart(
        barChartData = BarChartData(
            bars = listOf(
                BarChartData.Bar(
                    label = "Bar 1",
                    value = randomValue(),
                    color = randomColor()
                ),
                BarChartData.Bar(
                    label = "Bar 2",
                    value = randomValue(),
                    color = randomColor()
                ),
                BarChartData.Bar(
                    label = "Bar 3",
                    value = randomValue(),
                    color = randomColor()
                ),
                BarChartData.Bar(
                    label = "Bar 4",
                    value = randomValue(),
                    color = randomColor()
                ),
            )
        ),
        // Optional properties.
        modifier = Modifier.fillMaxSize(),
        animation = simpleChartAnimation(),
        barDrawer = SimpleBarDrawer(),
        xAxisDrawer = SimpleXAxisDrawer(),
        yAxisDrawer = SimpleYAxisDrawer(),
        labelDrawer = SimpleValueDrawer()
    ) 
}

Stargazers over time

Stargazers over time

Github Stars Sparklines

Sparkline

Contributors

Contributors over time

Comments
  • Feature request: custom BarChart max value

    Feature request: custom BarChart max value

    Right now, BarChart max y value is fixed on the highest data point. It would be nice to be able to set the top y value to some other value. I have some extra markers I need to put at certain Y values beyond the top bar and I'm struggling to make it render correctly.

    opened by crizzis 4
  • Custom Labels for numeric values on Y-Axis

    Custom Labels for numeric values on Y-Axis

    I would like to replace the labels on the y-axis in a bar diagram while keeping the original structure. In my use case, I display an amount of time per day of week, which is currently displayed in minutes, but I'd like to change the format to something like 2:30 instead of 150. Is there an option for that?

    help wanted 
    opened by MarcelJurtz 2
  • @Preview is not working with PieChart

    @Preview is not working with PieChart

    @Preview
    @Composable
    fun PieChartPreview() {
        Box(modifier = Modifier.height(150.dp)) {
            PieChart(
                pieChartData = PieChartData(
                    slices = listOf(
                        PieChartData.Slice(25F, Color.Red),
                        PieChartData.Slice(45F, Color.Green),
                        PieChartData.Slice(20F, Color.Blue),
                    ),
                ),
                sliceDrawer = SimpleSliceDrawer(sliceThickness = 100f)
            )
        }
    }
    

    I am using a Android Studio 2021.1.1 Patch 3, with Jetpack Compose 1.1.1 I can display the chart no problem on my device

    bug 
    opened by crroush 2
  • compose chart for desktop in intelliJ IDEA

    compose chart for desktop in intelliJ IDEA

    Please help me for add implementation for compose chart desktop in my project intelliJ. I want to add charts(bar & pie) to compose desktop project.

    help wanted 
    opened by momeni1367 1
  • Typo in BarChart.kt

    Typo in BarChart.kt

    Hey, you have a typo in compose-charts/charts/src/main/java/me/bytebeats/views/charts/bar/BarChart.kt The classname now is BarChar instead of BarChart.

    opened by MarcelJurtz 1
  • Suggesion: X value formatter

    Suggesion: X value formatter

    First of all, congrats for the API, it's awesome and works like a glance.

    But just like in the Y axis there's a value formatter to customize how it's displayed, it'd be really useful to have the same on the X axis.

    Thanks in advance, keep working! This is awesome 🚀

    enhancement 
    opened by ArnyminerZ 1
  • Expose LineChartData's properties to public

    Expose LineChartData's properties to public

    Hi 👋 Firstly, I wanna say thank you for your helpful compose chart library. You saved me a lot of time to implement the LineChart on my current project.

    I am using LineChart from your library however the design looks a bit different from yours, that's why I have do to some stuff to customize the chart. I need to determine the max and min values to draw the text label on top of the points. So I am asking for the solution that we could expose the properties to public rather than private/internal 😄

    https://github.com/bytebeats/compose-charts/blob/b853af66e8b4ca71e76c8d056b90f34af9211ac7/charts/src/main/java/me/bytebeats/views/charts/line/LineChartData.kt#L19-L32

    opened by hoangnguyen92dn 0
Owner
Chen Pan
New Generation Peasant-LABOUR.
Chen Pan
Android library for drawing Pie charts and Donut charts with the ability to customize almost anything in it.

A Pie/Donut*/Ring chart for Android, customizable to the most extent possible. For tutorial and examples refer to the website. build.gradle[.kts] impl

Mahdi Hosseinzadeh 20 Nov 18, 2022
An open source library used to draw charts in Android with Jetpack Compose with a simple and easy to use

android-compose-charts This is an open source library used to draw charts in Android with Jetpack Compose with a simple and easy to use. Just couples

Mahmoud Ibrahim 17 Dec 31, 2022
TChart - Simple and fast charts.

TChart - Simple and fast charts.

null 30 Sep 20, 2022
An android compose library with different Graphs and Charts

plot An android compose library with different Graphs and Charts (currently supports only Line graph, more types will be added soon) Download reposito

Madrapps 106 Dec 30, 2022
AnyChart Android Chart is an amazing data visualization library for easily creating interactive charts in Android apps. It runs on API 19+ (Android 4.4) and features dozens of built-in chart types.

AnyChart for Android AnyChart Android Charts is an amazing data visualization library for easily creating interactive charts in Android apps. It runs

AnyChart 2k Jan 4, 2023
Android Library to rapidly develop attractive and insightful charts in android applications.

williamchart Williamchart is an Android Library to rapidly implement attractive and insightful charts in android applications. Note: WilliamChart v3 h

Diogo Bernardino 4.9k Dec 30, 2022
Android Library to rapidly develop attractive and insightful charts in android applications.

williamchart Williamchart is an Android Library to rapidly implement attractive and insightful charts in android applications. Note: WilliamChart v3 h

Diogo Bernardino 4.8k Dec 22, 2021
Charts/graphs library for Android compatible with API 8+, several chart types with support for scaling, scrolling and animations

HelloCharts for Android Charting library for Android compatible with API 8+(Android 2.2). Works best when hardware acceleration is available, so API 1

Leszek Wach 7.4k Jan 6, 2023
A powerful 🚀 Android chart view / graph view library, supporting line- bar- pie- radar- bubble- and candlestick charts as well as scaling, panning and animations.

⚡ A powerful & easy to use chart library for Android ⚡ Charts is the iOS version of this library Table of Contents Quick Start Gradle Maven Documentat

Philipp Jahoda 36k Dec 31, 2022
An easy-to-use Android charts library with animation.

AndroidCharts A simple Android charts library. Known Uses in Pomotodo Including in Your Project Eclipse Import /AndroidCharts folder. Move /java folde

HackPlan 1.3k Jan 2, 2023
YBKChart is a library of 3D graphics charts for Android. 📊

YBKChart is a library of 3D graphics charts for Android. ?? For more information, see the Wiki. Chart List Pie Chart Download Use gradle. rep

ByungKwan Yun 10 Jun 19, 2022
Library for charts in android with animations

Charts Gradle Setup Step 1. Add the JitPack repository to your build file Add it in your root build.gradle at the end of repositories: allprojects {

Ayush Saini 4 Dec 30, 2022
Donut is an Android library which helps you to easily create beautiful doughnut-like charts.

Doughnut-like graph view capable of displaying multiple datasets with assignable colors

Futured 509 Jan 3, 2023
Straiberry Charts - An awesome Chart library for android

Straiberry Charts An awesome Chart library for android Straiberry · Report Bug · Request Feature Getting Started Adding dependecies Add it in your roo

StrAIberry 30 Dec 30, 2022
Arc Chart View (Draw Creative Statistic Arc Charts)

ArcChartViewDemo You can use this library to draw Arc charts and show your statistics or anything you want or maybe get some ratings from user. you ca

Iman khoshabi 106 Nov 22, 2022
Jetpack-linear-chart - A simple way to draw linear chart using Jetpack Compose

jetpack-linear-chart A simple way to draw linear chart using Jetpack Compose We

Bruno Gabriel dos Santos 8 Jan 4, 2023
Open-source native Android graph/chart framework includes line chart,stick chart,candlestick chart,pie chart,spider-web chart etc.

Welcome to Android-Charts Welcome to Android-Charts project page on github.com. We just moved from Google Code. Android-Charts is an open-source andro

limc.cn 813 Dec 20, 2022