Kotlin / kandy

Kotlin plotting library.
https://kotlin.github.io/kandy/
Apache License 2.0
603 stars 16 forks source link

Add `withData` #448

Open AndreiKingsley opened 1 week ago

AndreiKingsley commented 1 week ago

Partially solves #430. Add withData {} that allows to modify dataset for layers. Supports DataFrame extensions.

AndreiKingsley commented 1 week ago

Example:

val df1 = dataFrameOf(
    "x1" to listOf(1, 2, 5),
    "y1" to listOf(3, 4, 5)
)
val df2 = dataFrameOf(
    "x2" to listOf(3, 4, 5),
    "y2" to listOf(1, 2, 7)
)

df1.plot { 
    line { 
        x(x1)
        y(y1)
    }
    withData(df2) {
        points {
            x(x2)
            y(y2)   
        }
    }
}