Skip to content
/ plot Public

An android compose library with different Graphs and Charts

License

Notifications You must be signed in to change notification settings

Madrapps/plot

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

81cc628 · Oct 31, 2022
Aug 30, 2021
Aug 29, 2021
Oct 31, 2022
Oct 31, 2022
Aug 30, 2021
Oct 31, 2022
Jul 22, 2021
Aug 9, 2021
Aug 30, 2021
Oct 31, 2022
Jul 22, 2021
Jul 22, 2021
Jul 22, 2021
Oct 31, 2022

Repository files navigation

plot

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

Line Graph 1

Line Graph 1  Line Graph 2  Line Graph 3  Line Graph 4

Download

repositories {
  mavenCentral()
}

dependencies {
  implementation 'com.github.madrapps:plot:0.1.1'
}

Features

  • Full customization of the various parts of the graph (like the point, line between the points, highlight when selected, the values in x-axis and y-axis, etc...)
  • Supports scrolling, zooming and touch drag selection

Usage

Just add the LineGraph composable and pass it a LinePlot with all your configuration and customisation. Please take a look at the sample app to see the various customisations available. Almost every aspect of the graph is customisable. You can even override the default draw implementations and can draw a Rectangle instead of a Circle, etc. The below code renders the Orange graph that you see in the above screenshots.

@Composable
fun SampleLineGraph(lines: List<List<DataPoint>>) {
    LineGraph(
        plot = LinePlot(
            listOf(
                LinePlot.Line(
                    lines[0],
                    LinePlot.Connection(color = Red300),
                    LinePlot.Intersection(color = Red500),
                    LinePlot.Highlight(color = Yellow700),
                )
            ),
            grid = LinePlot.Grid(Red100, steps = 4),
        ),
        modifier = Modifier.fillMaxWidth().height(200.dp),
        onSelection = { xLine, points ->
            // Do whatever you want here
        }
    )
}

License

plot by Madrapps is licensed under the Apache License 2.0.