Search in sources :

Example 46 with Node

use of javafx.scene.Node in project bitsquare by bitsquare.

the class VolumeChart method seriesRemoved.

@Override
protected void seriesRemoved(XYChart.Series<Number, Number> series) {
    for (XYChart.Data<Number, Number> d : series.getData()) {
        final Node volumeBar = d.getNode();
        if (shouldAnimate()) {
            FadeTransition ft = new FadeTransition(Duration.millis(500), volumeBar);
            ft.setToValue(0);
            ft.setOnFinished((ActionEvent actionEvent) -> getPlotChildren().remove(volumeBar));
            ft.play();
        } else {
            getPlotChildren().remove(volumeBar);
        }
    }
}
Also used : FadeTransition(javafx.animation.FadeTransition) ActionEvent(javafx.event.ActionEvent) Node(javafx.scene.Node) XYChart(javafx.scene.chart.XYChart)

Example 47 with Node

use of javafx.scene.Node in project bitsquare by bitsquare.

the class VolumeChart method createCandle.

private Node createCandle(int seriesIndex, final XYChart.Data item, int itemIndex) {
    Node volumeBar = item.getNode();
    if (volumeBar instanceof VolumeBar) {
        ((VolumeBar) volumeBar).setSeriesAndDataStyleClasses("series" + seriesIndex, "data" + itemIndex);
    } else {
        volumeBar = new VolumeBar("series" + seriesIndex, "data" + itemIndex, toolTipStringConverter);
        item.setNode(volumeBar);
    }
    return volumeBar;
}
Also used : Node(javafx.scene.Node)

Example 48 with Node

use of javafx.scene.Node in project bitsquare by bitsquare.

the class VolumeChart method dataItemAdded.

@Override
protected void dataItemAdded(XYChart.Series<Number, Number> series, int itemIndex, XYChart.Data<Number, Number> item) {
    Node volumeBar = createCandle(getData().indexOf(series), item, itemIndex);
    if (getPlotChildren().contains(volumeBar))
        getPlotChildren().remove(volumeBar);
    if (shouldAnimate()) {
        volumeBar.setOpacity(0);
        getPlotChildren().add(volumeBar);
        FadeTransition ft = new FadeTransition(Duration.millis(500), volumeBar);
        ft.setToValue(1);
        ft.play();
    } else {
        getPlotChildren().add(volumeBar);
    }
}
Also used : FadeTransition(javafx.animation.FadeTransition) Node(javafx.scene.Node)

Example 49 with Node

use of javafx.scene.Node in project bitsquare by bitsquare.

the class CandleStickChart method seriesRemoved.

@Override
protected void seriesRemoved(XYChart.Series<Number, Number> series) {
    // remove all candle nodes
    for (XYChart.Data<Number, Number> d : series.getData()) {
        final Node candle = d.getNode();
        if (shouldAnimate()) {
            FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
            ft.setToValue(0);
            ft.setOnFinished((ActionEvent actionEvent) -> {
                getPlotChildren().remove(candle);
            });
            ft.play();
        } else {
            getPlotChildren().remove(candle);
        }
    }
    if (series.getNode() instanceof Path) {
        Path seriesPath = (Path) series.getNode();
        if (shouldAnimate()) {
            FadeTransition ft = new FadeTransition(Duration.millis(500), seriesPath);
            ft.setToValue(0);
            ft.setOnFinished((ActionEvent actionEvent) -> {
                getPlotChildren().remove(seriesPath);
                seriesPath.getElements().clear();
            });
            ft.play();
        } else {
            getPlotChildren().remove(seriesPath);
            seriesPath.getElements().clear();
        }
    }
}
Also used : Path(javafx.scene.shape.Path) FadeTransition(javafx.animation.FadeTransition) ActionEvent(javafx.event.ActionEvent) Node(javafx.scene.Node) XYChart(javafx.scene.chart.XYChart)

Example 50 with Node

use of javafx.scene.Node in project bitsquare by bitsquare.

the class VolumeChart method seriesAdded.

@Override
protected void seriesAdded(XYChart.Series<Number, Number> series, int seriesIndex) {
    for (int j = 0; j < series.getData().size(); j++) {
        XYChart.Data item = series.getData().get(j);
        Node volumeBar = createCandle(seriesIndex, item, j);
        if (shouldAnimate()) {
            volumeBar.setOpacity(0);
            getPlotChildren().add(volumeBar);
            FadeTransition ft = new FadeTransition(Duration.millis(500), volumeBar);
            ft.setToValue(1);
            ft.play();
        } else {
            getPlotChildren().add(volumeBar);
        }
    }
}
Also used : FadeTransition(javafx.animation.FadeTransition) Node(javafx.scene.Node) XYChart(javafx.scene.chart.XYChart)

Aggregations

Node (javafx.scene.Node)130 Stage (javafx.stage.Stage)25 Parent (javafx.scene.Parent)23 Label (javafx.scene.control.Label)19 ArrayList (java.util.ArrayList)18 ObservableList (javafx.collections.ObservableList)16 Button (javafx.scene.control.Button)16 List (java.util.List)15 Scene (javafx.scene.Scene)15 FXML (javafx.fxml.FXML)14 BorderPane (javafx.scene.layout.BorderPane)13 IOException (java.io.IOException)12 HBox (javafx.scene.layout.HBox)12 Color (javafx.scene.paint.Color)12 Platform (javafx.application.Platform)10 Insets (javafx.geometry.Insets)10 FXCollections (javafx.collections.FXCollections)9 MouseEvent (javafx.scene.input.MouseEvent)9 VBox (javafx.scene.layout.VBox)9 FadeTransition (javafx.animation.FadeTransition)8