Coder Social home page Coder Social logo

charter's Introduction

Charter

Charter

Another chart library for Android.

Kotlin Build Status Codecov GitHub (pre-)release

GETTING STARTED

Charter (pre-)releases are available via JitPack. It is recommended that a specific release version is selected when using the library in production as there may be breaking changes at anytime.

Tip: Test out the canary channel to try out features by using the latest develop snapshot; develop-SNAPSHOT.

// Project level build.gradle
// ...
repositories {
    maven { url 'https://jitpack.io' }
}
// ...

// Module level build.gradle
dependencies {
    // Replace version with release version, e.g. 1.0.0-alpha, -SNAPSHOT
    implementation "io.karn:charter:[VERSION]"
}

USAGE

The most basic case of the LineChart is as follows:

Create the object within your layout.

<io.karn.charter.charts.LineChart
    android:id="@+id/chart"
    android:layout_width="match_parent"
    android:layout_height="200dp"
    app:axisColor="@android:color/darker_gray"
    app:labelColor="@android:color/black" />

Attach the data to the Chart.

val dataMatrix = LineChart.DataMatrix(
    // X-Axis Labels
    arrayListOf("0", "1", "2", "3", "4"),
    // Data
    arrayListOf(
         LineChart.DataObject(
            "Score", // Label of the data which is used for the legend.
            0x2CC1FF, // The color code of the data points.
            arrayListOf(145f, 230f, 170f, 200f, 300f) // The data points -- must be of the same length as a the X-Axis labels.
        )
        // ...
    )
)

// Settings the data automatically refreshes the chart.
chart.setData(dataMatrix)
// You can also react to the nodes that are clicked by attaching a click handler.
deltas_chart.setOnTooltipChanged { nodes -> // nodes: List<Pair<String, Float>>
    // Iterate through the list of data points at that X-Axis index.
    for (item in nodes) {
        Log.v(TAG, "${item.first}: ${item.second}.")
    }
}

You'll get something that looks like this:

Sample

The headings and legend are left to the developer who can add that data in surrounding views.

CONTRIBUTING

There are many ways to contribute, you can

  • submit bugs,
  • help track issues,
  • review code changes.

charter's People

Contributors

karn avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

vaimalaviya1233

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.