plot

Project Url: Madrapps/plot
Introduction: An android compose library with different Graphs and Charts
More: Author   ReportBugs   
Tags:

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.

Apps
About Me
GitHub: Trinea
Facebook: Dev Tools