Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Kandy – Histograms don't work – Unresolved reference: histogram

I tried to reproduce the simple Kotlin Kandy histogram example at https://kotlin.github.io/kandy/histogram-simple.html.

val random = java.util.Random(42)

val dataframe = dataFrameOf(
    "sample" to List(1000) { random.nextGaussian() }
)

dataframe.plot {
    histogram("sample")
}

However, I get the error:

Unresolved reference: histogram

It seems like the unit tests depend on import org.jetbrains.kotlinx.statistics.kandy.layers.histogram, but I can’t find that class anywhere and IntelliJ won’t resolve the import.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I’m using these dependencies in a desktop Kotlin project:

dependencies {
  implementation("org.jetbrains.kotlinx:kandy-lets-plot:0.7.1")
  implementation("org.jetbrains.kotlinx:kandy-echarts:0.7.1")
  implementation("org.jetbrains.kotlinx:kandy-util:0.7.1")
  implementation("org.jetbrains.kotlinx:kandy-api:0.7.1")
}

To Reproduce

Steps to reproduce the behavior:

  1. Try demo simple histogram in Kotlin desktop project with main function

Expected behavior

Histogram should be generated:

image

Actual Behavior

Application doesn’t build – it can’t find histogram

**Related

I opened a bug for this on the Kandy GitHub repo at https://github.com/Kotlin/kandy/issues/443

>Solution :

According to this page, you need an extra dependency for the things in the org.jetbrains.kotlinx.statistics package.

repositories {
    mavenCentral()
    maven("https://packages.jetbrains.team/maven/p/kds/kotlin-ds-maven")
}

dependencies {
    implementation("org.jetbrains.kotlinx:kandy-lets-plot:0.7.0")

    // this below!
    implementation("org.jetbrains.kotlinx:kotlin-statistics-jvm:0.3.1")
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading