Example usage for javafx.scene.shape Rectangle layoutXProperty

List of usage examples for javafx.scene.shape Rectangle layoutXProperty

Introduction

In this page you can find the example usage for javafx.scene.shape Rectangle layoutXProperty.

Prototype

public final DoubleProperty layoutXProperty() 

Source Link

Usage

From source file:view.FXApplicationController.java

final public void computeKCfeatures() {

    overlay4.getChildren().clear();//w w  w. ja  va 2  s .  c  o  m

    kcDetector.detect(displayBuffer[featureModel.getFeatureChannel()]);
    double percentageSum = kcDetector.getPercentageSum();
    Set<Range<Integer>> kcPlotRanges = kcDetector.getKcRanges();

    kComplexLabel.setVisible(true);
    kComplexLabel.setText("K-Complex: " + Math.round(percentageSum) + "%");

    //draw yellow rectangles for every pair of coordinates in kcPlotRanges
    double start;
    double stop;

    for (Range<Integer> next : kcPlotRanges) {
        start = next.lowerEndpoint();
        stop = next.upperEndpoint();

        Rectangle r = new Rectangle();
        r.layoutXProperty()
                .bind(this.xAxis.widthProperty().multiply((start + 1.) / (double) this.displayBuffer[0].length)
                        .add(this.xAxis.layoutXProperty()));

        r.setLayoutY(0);
        r.widthProperty()
                .bind(xAxis.widthProperty().multiply((stop - start) / (double) this.displayBuffer[0].length));

        r.heightProperty().bind(overlay4.heightProperty());
        r.fillProperty().setValue(Color.LIGHTBLUE);
        r.opacityProperty().set(0.5);

        overlay4.getChildren().add(r);

    }

    lineChart.requestFocus();
}