JetBrains / lets-plot-kotlin

Grammar of Graphics for Kotlin
https://lets-plot.org/kotlin/
MIT License
430 stars 36 forks source link

Jetpack Compose Frontend #71

Closed smallshen closed 10 months ago

smallshen commented 3 years ago

since there are javafx frontend, are there any plan about having Jetpack Compose Frontend?

alshan commented 3 years ago

At the moment nobody is working on this but compose frontend sounds interesting. If compose canvas is similar to jfx scene and also supports CSS than this task doesn't seem extremely difficult.

Ideally the same code would work on desktop and Android.

smallshen commented 3 years ago

Jetpack Compose is powered by Skia, you can look into the jetpack compose canvas which is a drawScope under package androidx.compose.ui.graphics.drawscope.

But I think it would be better just asking people who work at Jetpack Compose Desktop in JetBrains.

Right now I export the image bytearray without write into files, changing the color to transparently and blablabla, not efficient.

Jetpack Compose support render svg files but it is buggy with the svg output by let's plot.

Moreover, Jetpack Compose' API is really lightweight and easy to use, it would be good to have full integration such animations( only one line aniamte...asState() ), clickable charts etc.

alshan commented 3 years ago

Right now I export the image bytearray without write into files, changing the color to transparently and blablabla, not efficient.

This is terrible) Do you mean you export lets-plot plot as an image? If Jetpack Compose supports android webview then it should be possible to render interactive plots using webview.

Speaking of Compose for Desktop, my understanding is that it's possible to use Swing components in Compose for Desktop app.

Of course, rendering to compose canvas would be preferable anyhow.

smallshen commented 3 years ago

yes export to image, it is terrible. Jetpack compose desktop is based on skia (skiko is what they use for jvm bindings), I am not expert on that too, but I guess make fronted for skia could have more extensibility than only jetpack compose desktop.

Also I am trying to make skiko work with lwjgl( allow jetpack compose draw in lwjgl ), it could render plots directly in jvm games.

ppaanngggg commented 2 years ago

the same problem, I want to use compose to build my next application, but I can't find a good chart library suitable with compose.

lets-plot-kotlin will be awesome if armed with compose.

alshan commented 2 years ago

We are planning to attempt drawing plots on compose canvas but at the moment there is no certainty on the time frame. Meanwhile you can try lets-plot Swing component (desktop) or android Webview for rendering.

smallshen commented 2 years ago

The canvas is really similar, however, compose doesn't support CSS, but the Modifier (How we modify components with compose) is really straightforward.

alshan commented 2 years ago

but the Modifier

Thanx! Will take a look.

ThraaxSession commented 1 year ago

Any updates on this? I was looking for a graph lib which works with Kotlin Compose Multiplatform, as there aren't many. I look forward for let's plot!

alshan commented 1 year ago

There actually is some progress. I hope we'll be able to release new skiko-based rendering engine along with compose lets-plot composables in a matter of few weeks. Initially only targeting Desktop and Android.

changhexuefei commented 11 months ago

Lets-plot-kotlin supporting Compose for desktop will be released soon? I am looking forward to it and there is a need to use it.

alshan commented 11 months ago

@changhexuefei This is the plan yes.

alshan commented 11 months ago

Good news! We've just released Lets-Plot Skia Frontend targeting Compose-Multiplatform' Desktop and Android platforms. You will find minimal examples of charts at lets-plot-compose-demos GitHub repo. We tested the demos in IntelliJ IDEA only. Would appreciate any feedback on your experience with the demos in Android Studio. As well as any other feedback of course.

smallshen commented 11 months ago

This is amazing!