lets-plot-kotlin icon indicating copy to clipboard operation
lets-plot-kotlin copied to clipboard

Jetpack Compose Frontend

Open smallshen opened this issue 4 years ago • 8 comments

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

smallshen avatar May 01 '21 23:05 smallshen

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.

alshan avatar May 03 '21 17:05 alshan

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.

smallshen avatar May 03 '21 22:05 smallshen

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.

alshan avatar May 08 '21 00:05 alshan

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.

smallshen avatar May 08 '21 01:05 smallshen

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.

ppaanngggg avatar Jan 06 '22 16:01 ppaanngggg

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.

alshan avatar Jan 10 '22 20:01 alshan

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

smallshen avatar Jan 10 '22 20:01 smallshen

but the Modifier

Thanx! Will take a look.

alshan avatar Jan 10 '22 21:01 alshan

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!

ThraaxSession avatar Aug 28 '23 20:08 ThraaxSession

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.

alshan avatar Aug 29 '23 18:08 alshan

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.

changhexuefei avatar Sep 27 '23 07:09 changhexuefei

@changhexuefei This is the plan yes.

alshan avatar Sep 27 '23 20:09 alshan

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.

alshan avatar Oct 05 '23 20:10 alshan

This is amazing!

smallshen avatar Oct 13 '23 21:10 smallshen