use of javafx.animation.FadeTransition in project bitsquare by bitsquare.
the class CandleStickChart method seriesAdded.
@Override
protected void seriesAdded(XYChart.Series<Number, Number> series, int seriesIndex) {
// handle any data already in series
for (int j = 0; j < series.getData().size(); j++) {
XYChart.Data item = series.getData().get(j);
Node candle = createCandle(seriesIndex, item, j);
if (!getPlotChildren().contains(candle)) {
getPlotChildren().add(candle);
if (shouldAnimate()) {
candle.setOpacity(0);
FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
ft.setToValue(1);
ft.play();
}
}
}
Path seriesPath = new Path();
seriesPath.getStyleClass().setAll("candlestick-average-line", "series" + seriesIndex);
series.setNode(seriesPath);
if (!getPlotChildren().contains(seriesPath)) {
getPlotChildren().add(seriesPath);
if (shouldAnimate()) {
seriesPath.setOpacity(0);
FadeTransition ft = new FadeTransition(Duration.millis(500), seriesPath);
ft.setToValue(1);
ft.play();
}
}
}
use of javafx.animation.FadeTransition in project bitsquare by bitsquare.
the class VolumeChart method dataItemRemoved.
@Override
protected void dataItemRemoved(XYChart.Data<Number, Number> item, XYChart.Series<Number, Number> series) {
final Node node = item.getNode();
if (shouldAnimate()) {
FadeTransition ft = new FadeTransition(Duration.millis(500), node);
ft.setToValue(0);
ft.setOnFinished((ActionEvent actionEvent) -> getPlotChildren().remove(node));
ft.play();
} else {
getPlotChildren().remove(node);
}
}
Aggregations