Giter Site home page Giter Site logo

Comments (11)

HanSolo avatar HanSolo commented on August 18, 2024

Fixed with commit 2c52447

from tilesfx.

dmyrdek avatar dmyrdek commented on August 18, 2024

Thanks, but now for me, I can only select a TreeNode once, then you can't select anything again.

from tilesfx.

HanSolo avatar HanSolo commented on August 18, 2024

Can you add some sample code of your problem? Would make things much easier to figure out...

from tilesfx.

dmyrdek avatar dmyrdek commented on August 18, 2024
foldersSunburstChart = TileBuilder.create()
         .skinType(Tile.SkinType.SUNBURST)
         .backgroundColor(Color.TRANSPARENT)
         .sunburstBackgroundColor(Color.TRANSPARENT)
         .title("Folder Structure")
         .textVisible(true)
         .titleAlignment(TextAlignment.LEFT)
         .sunburstTextOrientation(SunburstChart.TextOrientation.HORIZONTAL)
         .minSize(400, 480)
         .prefSize(400, 480)
         .sunburstTree(currentUser.getFoldersCountForSunburst())
         .sunburstInteractive(true)
          .build();

foldersSunburstChart.setOnTileEvent((e) -> {
                        if (e.getEventType() == TileEvent.EventType.SELECTED_CHART_DATA) {
                            System.out.println("Clicked on folder " + e.getData().getName());
                            addFilter(e.getData().getName(), false, true, false, false, false);
                        }
                    });
masonryPane.getChildren().add(foldersSunburstChart);

It only knows I click on a Tree Node if I click immediately after you're "check 1 check 2" prints. If I click our wait a second it doesn't register any onTileEvents.

from tilesfx.

HanSolo avatar HanSolo commented on August 18, 2024

Well when I use the following code I get all SELECTED_CHART_DATA events when clicking on the sunburst chart...
`
tile = TileBuilder.create().skinType(SkinType.SUNBURST)
.prefSize(400, 400)
.title("SunburstTile")
.textVisible(false)
.sunburstTree(tree)
.sunburstBackgroundColor(Tile.BACKGROUND)
.sunburstTextColor(Tile.BACKGROUND)
.sunburstUseColorFromParent(true)
.sunburstTextOrientation(TextOrientation.TANGENT)
.sunburstAutoTextColor(true)
.sunburstUseChartDataTextColor(true)
.sunburstInteractive(true)
.build();

    tile.setOnTileEvent(e -> {
        System.out.println("TileEvent");
        switch(e.getEventType()) {
            case SELECTED_CHART_DATA: System.out.println(e.getData()); break;
        }
    });

`

from tilesfx.

dmyrdek avatar dmyrdek commented on August 18, 2024

I just figured out it's because I start a new thread that extends Task

backgroundSentiment = new BackgroundSentiment();
Thread t2 = new Thread(backgroundSentiment);
backgroundSentiment.setOnSucceeded(evt -> {

});
t2.start();

Not sure why this would prevent me from only being able to click on a Sunburst chart, but all other tiles work?

from tilesfx.

HanSolo avatar HanSolo commented on August 18, 2024

Well the question is why do you access the control from a different thread? UI controls should only be accessed on the FX Apllication Thread in JavaFX. You can use Platform.runLater() to do so or simply make sure you access the controls on the FX Application Thread.

from tilesfx.

dmyrdek avatar dmyrdek commented on August 18, 2024

My suspicions were wrong, it has nothing to do with that thread. The creation and interaction of the sunburst chart are all happing in the FX Application thread inside of controllers initialize. There's just a second or two where you can select a tree node then after you can't.

from tilesfx.

dmyrdek avatar dmyrdek commented on August 18, 2024

Figure it out actually, this was the culprit running in the same initialize method in the controller.

updateGauge = new Thread(new Runnable() {
                        @Override
                        public void run() {
                            while (true) {
                                try {
                                    Thread.sleep(1000);
                                } catch (InterruptedException e) {
                                    System.out.println("Thread was interrupted");
                                    break;
                                }
                                sentimentGauge.setValue(Email.getOverallSentimentDbl(currentUser.getOverallSentiment()));
                            }
                        }
                    });
updateGauge.start();

Is there a reason why that would break only the Sunburst Chart interactivty, but not a radial chart?

from tilesfx.

HanSolo avatar HanSolo commented on August 18, 2024

Like I said before you habe to modify controls on the FXApplication Thread, this is a mandatory thing on all ui frameworks. So modifying the ui directly from a separate thread is simply wrong.

from tilesfx.

dmyrdek avatar dmyrdek commented on August 18, 2024

Sorry to waste your time, this is a group project I didn't write any of that

from tilesfx.

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.