Coder Social home page Coder Social logo

Comments (5)

HanSolo avatar HanSolo commented on August 26, 2024 1

Just for your info, I've released 11.8 which is more or less a backport of the jdk16 branch, meaning to say it contains a lot of changes and additional charts.

from charts.

HanSolo avatar HanSolo commented on August 26, 2024

Of course that‘s possible but please provide a code snippet that shows the problem so that I can reproduce it.

from charts.

permiakover avatar permiakover commented on August 26, 2024

I take LineChartTest and add presenters here, i tried several times. The values are added, but it is possible to show them, only after manual screen resize.

Here is presenters, first in Kotlin. It uses specific dispatcher to be ok, but its not even with runLater

class Presenter(xySeries1: XYSeries<XYItem>) {

    init {
        var x = 12.0
        CoroutineScope(Dispatchers.JavaFX).launch {
            while(true){
                println("Hello")
                delay(1000)
                Platform.runLater {
                    xySeries1.items.add(XYChartItem(++x, 160.0," "))
                }
            }
        }
    }
}

Then I check the java version of the same presenter with thread

public class Presenter2 {

    public Presenter2 (XYSeries xySeries){

        new Thread(new Runnable() {
            @Override
            public void run() {
                int x = 0;
                while (true){
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    int finalX = x;
                    Platform.runLater(() -> xySeries.getItems().add(new XYChartItem(finalX, 160, "")));
                    x++;

                }
            }
        }).start();
    }
}

but it also didn't work

and i tried with the third presenter, that uses method of application

public class Presenter3 {

    public Presenter3(App application) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                int x = 0;
                while (true) {
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    Platform.runLater(() -> application.addValue());
                }
            }
        }).start();
    }
}

new application method:

   public void addValue() {
        Platform.runLater(() -> {
            xySeries1.getItems().add(new XYChartItem(x, 160, ""));
        });
        x++;
    }

from charts.

HanSolo avatar HanSolo commented on August 26, 2024

Ok, now I see. Fixed it in the JDK16 branch with commit 39d8877.
If I find time I will also backport it to 11.

from charts.

permiakover avatar permiakover commented on August 26, 2024

Thank you for the work!

from charts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.