Skip to content

samarthraj11/compose-nav-chart

Repository files navigation

ComposeNavChart

A small Compose Multiplatform library for rendering animated NAV charts on Android and iOS.

The chart is extracted from a production portfolio graph and made reusable with neutral data models, configurable line styles, date labels, tooltips, and scrub interaction.

Preview

ComposeNavChart preview

Variations

Default Dark
Default ComposeNavChart preview Dark ComposeNavChart preview
Emerald Single line
Emerald ComposeNavChart preview Single-line ComposeNavChart preview
Multi-series
Multi-series ComposeNavChart preview

Install

JitPack

Add JitPack to your repositories:

repositories {
    google()
    mavenCentral()
    maven("https://jitpack.io")
}

Then add the dependency:

commonMain.dependencies {
    implementation("com.github.samarthraj11:compose-nav-chart:0.2.2")
}

Maven Local

For local development:

./gradlew :compose-nav-chart:publishToMavenLocal

Then consume it from another local project:

repositories {
    mavenLocal()
    mavenCentral()
    google()
}

commonMain.dependencies {
    implementation("io.github.samarthraj11:compose-nav-chart:0.2.2")
}

The configured Maven group is io.github.samarthraj11.

Usage

@Composable
fun PortfolioChart() {
    ComposeNavChart(
        series = listOf(
            NavSeries(
                name = "Fund",
                points = listOf(
                    NavPoint(timestampMillis = 1_767_225_600_000L, value = 100.0),
                    NavPoint(timestampMillis = 1_769_904_000_000L, value = 108.4),
                    NavPoint(timestampMillis = 1_772_323_200_000L, value = 112.1),
                ),
            ),
            NavSeries(
                name = "Benchmark",
                points = listOf(
                    NavPoint(timestampMillis = 1_767_225_600_000L, value = 100.0),
                    NavPoint(timestampMillis = 1_769_904_000_000L, value = 105.2),
                    NavPoint(timestampMillis = 1_772_323_200_000L, value = 109.7),
                ),
            ),
        ),
        onScrubChange = { points ->
            // Update legend values while the user drags over the chart.
        },
    )
}

Publishing

This project is configured with Gradle maven-publish.

Maven local:

./gradlew :compose-nav-chart:publishToMavenLocal

Maven Central manual release:

./gradlew :compose-nav-chart:publishToMavenCentral

Maven Central automatic release:

./gradlew :compose-nav-chart:publishAndReleaseToMavenCentral

Publishing to Maven Central requires Central Portal user-token credentials and a signing key in Gradle properties or environment variables.

Required Gradle properties:

mavenCentralUsername=...
mavenCentralPassword=...
signingInMemoryKey=...
signingInMemoryKeyPassword=...

These can also be supplied as environment variables with the ORG_GRADLE_PROJECT_ prefix.

License

Apache License 2.0

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages