Skip to content

Commit 4e88a17

Browse files
Update KDF versions in examples and add Kandy example in KDFCP project
1 parent ad2c10e commit 4e88a17

File tree

4 files changed

+36
-15
lines changed

4 files changed

+36
-15
lines changed

examples/android-example/app/build.gradle.kts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,12 @@ dependencies {
6464
debugImplementation(libs.androidx.ui.tooling)
6565
debugImplementation(libs.androidx.ui.test.manifest)
6666

67-
// TODO update version
6867
// Core Kotlin DataFrame API, JSON and CSV IO.
6968
// See custom Gradle setup:
7069
// https://kotlin.github.io/dataframe/setupcustomgradle.html
71-
implementation("org.jetbrains.kotlinx:dataframe-core:1.0.0-Beta3")
72-
implementation("org.jetbrains.kotlinx:dataframe-json:1.0.0-Beta3")
73-
implementation("org.jetbrains.kotlinx:dataframe-csv:1.0.0-Beta3")
70+
implementation("org.jetbrains.kotlinx:dataframe-core:1.0.0-Beta4")
71+
implementation("org.jetbrains.kotlinx:dataframe-json:1.0.0-Beta4")
72+
implementation("org.jetbrains.kotlinx:dataframe-csv:1.0.0-Beta4")
7473
// You can add any additional IO modules you like, except for 'dataframe-arrow'.
7574
// Apache Arrow is not supported well on Android.
7675
}

examples/android-example/gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[versions]
22
agp = "8.11.1"
3-
kotlin = "2.2.20"
3+
kotlin = "2.3.0-RC2"
44
coreKtx = "1.10.1"
55
junit = "4.13.2"
66
junitVersion = "1.1.5"

examples/kotlin-dataframe-plugin-example/build.gradle.kts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,26 @@ import org.jlleitschuh.gradle.ktlint.KtlintExtension
33
plugins {
44
id("org.jlleitschuh.gradle.ktlint") version "12.3.0"
55

6-
val kotlinVersion = "2.2.20"
6+
val kotlinVersion = "2.3.0-RC2"
77
kotlin("jvm") version kotlinVersion
8+
// Add the Kotlin DataFrame Compiler plugin of the same version as the Kotlin plugin.
89
kotlin("plugin.dataframe") version kotlinVersion
10+
11+
application
912
}
1013

1114
group = "org.example"
1215
version = "1.0-SNAPSHOT"
1316

1417
repositories {
15-
maven("https://packages.jetbrains.team/maven/p/kt/dev/")
1618
mavenCentral()
1719
}
1820

1921
dependencies {
20-
implementation("org.jetbrains.kotlinx:dataframe:1.0.0-Beta3")
22+
// Add general `dataframe` dependency
23+
implementation("org.jetbrains.kotlinx:dataframe:1.0.0-Beta4")
24+
// Add `kandy` dependency
25+
implementation("org.jetbrains.kotlinx:kandy-lets-plot:0.8.3")
2126
testImplementation(kotlin("test"))
2227
}
2328

examples/kotlin-dataframe-plugin-example/src/main/kotlin/org/jetbrains/kotlinx/dataframe/examples/plugin/Main.kt

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,22 @@ package org.jetbrains.kotlinx.dataframe.examples.plugin
33
import org.jetbrains.kotlinx.dataframe.DataFrame
44
import org.jetbrains.kotlinx.dataframe.annotations.DataSchema
55
import org.jetbrains.kotlinx.dataframe.api.add
6+
import org.jetbrains.kotlinx.dataframe.api.aggregate
67
import org.jetbrains.kotlinx.dataframe.api.convert
78
import org.jetbrains.kotlinx.dataframe.api.convertTo
89
import org.jetbrains.kotlinx.dataframe.api.filter
10+
import org.jetbrains.kotlinx.dataframe.api.groupBy
911
import org.jetbrains.kotlinx.dataframe.api.into
12+
import org.jetbrains.kotlinx.dataframe.api.max
1013
import org.jetbrains.kotlinx.dataframe.api.rename
1114
import org.jetbrains.kotlinx.dataframe.api.renameToCamelCase
1215
import org.jetbrains.kotlinx.dataframe.api.with
1316
import org.jetbrains.kotlinx.dataframe.io.readCsv
1417
import org.jetbrains.kotlinx.dataframe.io.writeCsv
18+
import org.jetbrains.kotlinx.kandy.dsl.plot
19+
import org.jetbrains.kotlinx.kandy.letsplot.export.save
20+
import org.jetbrains.kotlinx.kandy.letsplot.feature.layout
21+
import org.jetbrains.kotlinx.kandy.letsplot.layers.bars
1522
import java.net.URL
1623

1724
// Declare data schema for the DataFrame from jetbrains_repositories.csv.
@@ -83,11 +90,21 @@ fun main() {
8390
// Write the updated DataFrame to a CSV file.
8491
reposUpdated.writeCsv("jetbrains_repositories_new.csv")
8592

86-
// TODO: Add Kandy Plot
87-
// reposUpdated.groupBy { kind }.max { stargazersCount }.plot {
88-
// bars {
89-
// x(kind)
90-
// y(stargazersCount)
91-
// }
92-
// }
93+
reposUpdated
94+
// Group repositories by kind
95+
.groupBy { kind }
96+
// And then compute the maximum stars in each group.
97+
.aggregate {
98+
max { stars } into "maxStars"
99+
}
100+
// Build a bar plot showing the maximum number of stars per repository kind.
101+
.plot {
102+
bars {
103+
x(kind)
104+
y(maxStars)
105+
}
106+
layout.title = "Max stars per repo kind"
107+
}
108+
// Save the plot to an SVG file.
109+
.save("kindToStars.svg")
93110
}

0 commit comments

Comments
 (0)