Skip to content

Kotlin wrapper for Recharts library. This is a publish-only repository, all PRs are ignored. Contributions are welcome on GitLab.

License

Notifications You must be signed in to change notification settings

gm666q/kotlin-recharts

Repository files navigation

Kotlin Gitlab pipeline status Gitlab code coverage Maven metadata URL Bintray

kotlin-recharts

Kotlin wrapper for Recharts library.

This project is WIP.

Installation

Groovy DSL

repositories {
    maven { url 'https://gitlab.com/api/v4/projects/21457223/packages/maven' }
}

dependencies {
    implementation "space.gm666q:kotlin-recharts:${version}"
}

Kotlin DSL

repositories {
    maven("https://gitlab.com/api/v4/projects/21457223/packages/maven")
}

dependencies {
    implementation("space.gm666q:kotlin-recharts:${version}")
}

Example

data class Data(val amt: Int, val name: String, val pv: Int, val uv: Int)

val d = arrayOf<Any>(
    Data(2400, "Page A", 2400, 400),
    Data(2400, "Page B", 4567, 300),
    Data(2400, "Page C", 1398, 300),
    Data(2400, "Page D", 9800, 200),
    Data(2400, "Page E", 3908, 278),
    Data(2400, "Page F", 4800, 189)
)

fun main() {
    render(document.getElementById("root")) {
        lineChart {
            attrs {
                data = d
                height = 300
                margin = createMargin(5, 0, 20, 5)
                width = 600
            }
            cartesianGrid {
                attrs.asDynamic()["stroke"] = "#ccc"
                attrs.asDynamic()["strokeDasharray"] = "5 5"
            }
            line {
                attrs {
                    dataKey = DataKey.String(Data::uv.name)
                    type = CurveType.monotone
                }
                attrs.asDynamic()["stroke"] = "#8884d8"
            }
            xAxis {
                attrs {
                    dataKey = DataKey.String(Data::name.name)
                }
            }
            yAxis {
            }
            tooltip {
            }
        }
    }
}

About

Kotlin wrapper for Recharts library. This is a publish-only repository, all PRs are ignored. Contributions are welcome on GitLab.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

Languages