SciProgCentre / plotly.kt

An interactive Kotlin wrapper for plotly visualization tools
https://sciprogcentre.github.io/plotly.kt/
Apache License 2.0
149 stars 21 forks source link

Charts with a single value do not display the value #55

Closed zakhenry closed 3 years ago

zakhenry commented 3 years ago

It seems ok with Plotly.js:

var data = [
  {
    x: ['giraffes'],
    y: [20],
    type: 'bar'
  }
];

Plotly.newPlot('myDiv', data);

https://codepen.io/zakhenry/pen/YzGPQMm

but not so with Plotly.kt


    val plot = Plotly.plot {
        bar {
            x("giraffes")
            y(20)
        }
    }
    plot.makeFile()
altavir commented 3 years ago

Thanks, It is a known problem. Plotly updater requires values in an array-of-arrays format even if there is one value. I thought it is fixed, but I can reproduce it. I think it will be easy to fix with a serializer tweak.

altavir commented 3 years ago

It was easier to slightly change the logic in the upstream. Fixed in 0.3.1-dev. I will leave the issue here until it is merged to JCenter version.

zakhenry commented 3 years ago

@altavir do you have some idea of the timeline for 0.3.1 being released?

altavir commented 3 years ago

@zakhenry Thanks for reminding me. I got stuck with the release of the upstream library. And I do not want to make release version depend on dev version. 0.3.1-dev is published on bintray and you can use it simply by adding maven("https://dl.bintray.com/mipt-npm/dev") to gradle configuration. Do you have any specific requirements for actual center artifact? If you do, I can try to speed-up things.

zakhenry commented 3 years ago

Ah yep I should be able to use dev, no trouble. Is it up to date with the latest master?

altavir commented 3 years ago

It should contain all major fixes from the dev branch. Please ping me if something does not work. I will upload the latest version. Currently, there is some work being done with kotlin-jupyter team to allow better integration.

altavir commented 3 years ago

Published in 0.3.1