Giter VIP home page Giter VIP logo

koalaplot-core's Introduction

Maven Central Kotlin Dokka docs License MIT

Koala Plot

Koala Plot is a Compose Multiplatform based charting and plotting library allowing you to build great looking interactive charts for Android, desktop, ios, and web using a single API and code base.

Try out the web version of the samples for a quick look at the possibilities when using Koala Plot. Note that this uses the alpha Compose web-canvas capability, so there may be bugs in the underlying Compose Web framework.

This project is in a pre-release experimental/alpha state. We encourage you to give it a try, make suggestions for improvement, and even contribute! It is expected that the API surface and functionality will change as we gain experience using the library in applications.

Current Features

Most elements of a plot are Composables and can therefore be easily customized. This includes things like colors, fonts, borders, shapes, user interaction, etc. Web support is provided by the Compose-web Canvas support currently in alpha.

  • Pie and donut chart
    • Composable slices, with default implementation that can react to hovering
    • Optional Composable labels and Composable connectors with provided linear and bezier implementations
    • Composable content for donut chart centers
    • Customizable first-draw animation
  • Line chart
    • Linear or Log y-axis
    • Numeric or category x-axis
    • Composable axis titles and value labels
    • Optional Composable symbols for data points
    • Optional Composable symbols at each data point with default implementations
    • Zoom and pan one or both axes (Android only, for now)
    • Optional shaded areas (area chart)
  • Stacked area chart
    • Plots multiple lines with shaded areas between them and accumulated values
    • Similar feature set as the Line chart
  • Vertical bar chart
    • Linear or Log y-axis
    • Numeric or category x-axis
    • Composable vertical bars with a provided default implementation
    • Support for clustered and stacked bars
    • Support for negative values and bars that don't start at 0
    • Customizable first-draw animation
    • Zoom and pan one or both axes (Android only, for now)
  • Bullet Graph
    • Individual or multiple vertically aligned bullet graphs
  • Chart layout
    • Combines an optional Composable title, plot, and legend with any of 4 positions
  • Legends
    • Single column
    • Flow-layout

Getting Started

  1. Add the mavenCentral and compose repositories to your project's build.gradle.kts
repositories {
    mavenCentral()
    maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}
  1. Include Koala Plot core as a dependency in your project's build.gradle.kts
dependencies {
    implementation("io.github.koalaplot:koalaplot-core:0.4.0")
}

You can also see a complete example of a build.gradle.kts in the samples.

  1. Start coding
    BulletGraph {
        label {
            Column(
                horizontalAlignment = Alignment.End,
                modifier = Modifier.padding(end = KoalaPlotTheme.sizes.gap)
            ) {
                Text(
                    "Revenue 2005 YTD",
                    textAlign = TextAlign.End
                )
                Text(
                    "(US $ in thousands)",
                    textAlign = TextAlign.End
                )
            }
        }
        axis { labels { "${it.toInt()}" } }
        comparativeMeasure(260f)
        featuredMeasureBar(275f)
        ranges(0f, 200f, 250f, 300f)
    }

Documentation

Also see the sample repository for code examples.

Contributing

Contributions are welcome. Further details can be found in the Contributing Guidelines

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.