Java Code Examples for javafx.scene.text.Text#setEffect()

The following examples show how to use javafx.scene.text.Text#setEffect() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IconText.java    From helloiot with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Node buildIcon(StringFormat format, byte[] value) {
    Text t = new Text(format.format(format.value(value)));
    t.setFont(Font.font(ExternalFonts.SOURCESANSPRO_BLACK, FontWeight.BOLD, 32.0));
    t.setFill(Color.WHITE);
    
    DropShadow dropShadow = new DropShadow();
    dropShadow.setRadius(4.0);
    dropShadow.setColor(Color.BLACK /* valueOf("#4b5157")*/);
    dropShadow.setBlurType(BlurType.ONE_PASS_BOX);
    t.setEffect(dropShadow);
   
    return t;
}
 
Example 2
Source File: DropShadowSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public DropShadowSample() {
    Text sample = new Text(0,40,"DropShadow Effect");
    sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,36));
    final DropShadow dropShadow = new DropShadow();
    sample.setEffect(dropShadow);
    getChildren().add(sample);
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Radius", dropShadow.radiusProperty(), 0d, 20d),
            new SimplePropertySheet.PropDesc("Offset X", dropShadow.offsetXProperty(), -10d, 10d),
            new SimplePropertySheet.PropDesc("Offset Y", dropShadow.offsetYProperty(), -10d, 10d),
            new SimplePropertySheet.PropDesc("Spread", dropShadow.spreadProperty(), 0d, 1d),
            new SimplePropertySheet.PropDesc("Color", dropShadow.colorProperty())
    );
    // END REMOVE ME
}
 
Example 3
Source File: DropShadowSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public DropShadowSample() {
    Text sample = new Text(0,40,"DropShadow Effect");
    sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,36));
    final DropShadow dropShadow = new DropShadow();
    sample.setEffect(dropShadow);
    getChildren().add(sample);
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Radius", dropShadow.radiusProperty(), 0d, 20d),
            new SimplePropertySheet.PropDesc("Offset X", dropShadow.offsetXProperty(), -10d, 10d),
            new SimplePropertySheet.PropDesc("Offset Y", dropShadow.offsetYProperty(), -10d, 10d),
            new SimplePropertySheet.PropDesc("Spread", dropShadow.spreadProperty(), 0d, 1d),
            new SimplePropertySheet.PropDesc("Color", dropShadow.colorProperty())
    );
    // END REMOVE ME
}
 
Example 4
Source File: InnerShadowSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public InnerShadowSample() {
    Text sample = new Text(0,100,"Shadow");
    sample.setFont(Font.font("Arial Black",80));
    sample.setFill(Color.web("#BBBBBB"));
    final InnerShadow innerShadow = new InnerShadow();
    innerShadow.setRadius(5d);
    innerShadow.setOffsetX(2);
    innerShadow.setOffsetY(2);
    sample.setEffect(innerShadow);
    getChildren().add(sample);
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Text Fill", sample.fillProperty()),
            new SimplePropertySheet.PropDesc("Inner Shadow Radius", innerShadow.radiusProperty(), 0d,60d),
            new SimplePropertySheet.PropDesc("Inner Shadow Offset X", innerShadow.offsetXProperty(), -10d, 10d),
            new SimplePropertySheet.PropDesc("Inner Shadow Offset Y", innerShadow.offsetYProperty(), -10d, 10d),
            new SimplePropertySheet.PropDesc("Inner Shadow Color", innerShadow.colorProperty())
    );
    // END REMOVE ME
}
 
Example 5
Source File: MenuItem.java    From FXTutorials with MIT License 5 votes vote down vote up
public MenuItem(String name, int width) {
    setAlignment(Pos.CENTER_LEFT);

    text = new Text(name);
    text.setTranslateX(5);
    text.setFont(font);
    text.setFill(Colors.MENU_TEXT);
    text.setStroke(Color.BLACK);

    shadow = new DropShadow(5, Color.BLACK);
    text.setEffect(shadow);

    selection = new Rectangle(width - 45, 30);
    selection.setFill(Colors.MENU_ITEM_SELECTION);
    selection.setStroke(Color.BLACK);
    selection.setVisible(false);

    GaussianBlur blur = new GaussianBlur(8);
    selection.setEffect(blur);

    getChildren().addAll(selection, text);

    setOnMouseEntered(e -> {
        onSelect();
    });

    setOnMouseExited(e -> {
        onDeselect();
    });

    setOnMousePressed(e -> {
        text.setFill(Color.YELLOW);
    });
}
 
Example 6
Source File: SpaceRunnerApp.java    From FXGLGames with MIT License 5 votes vote down vote up
private void nextLevel() {
    uiTextLevel.setVisible(false);

    inc("level", +1);

    level = new Level();
    level.spawnNewWave();

    Text textLevel = getUIFactory().newText("Level " + geti("level"), Color.WHITE, 22);
    textLevel.setEffect(new DropShadow(7, Color.BLACK));
    textLevel.setOpacity(0);

    centerText(textLevel);
    textLevel.setTranslateY(250);

    addUINode(textLevel);

    animationBuilder()
            .interpolator(Interpolators.SMOOTH.EASE_OUT())
            .duration(Duration.seconds(1.66))
            .onFinished(() -> {
                animationBuilder()
                        .duration(Duration.seconds(1.66))
                        .interpolator(Interpolators.EXPONENTIAL.EASE_IN())
                        .onFinished(() -> {
                            removeUINode(textLevel);
                            uiTextLevel.setVisible(true);
                        })
                        .translate(textLevel)
                        .from(new Point2D(textLevel.getTranslateX(), textLevel.getTranslateY()))
                        .to(new Point2D(330, 540))
                        .buildAndPlay();
            })
            .fadeIn(textLevel)
            .buildAndPlay();
}
 
Example 7
Source File: KeyStrokeMotion.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public LettersPane() {
    setId("LettersPane");
    setPrefSize(480,480);
    setFocusTraversable(true);
    setOnMousePressed(new EventHandler<MouseEvent>() {
        
        @Override public void handle(MouseEvent me) {
            requestFocus();
            me.consume();
        }
    });
    setOnKeyPressed(new EventHandler<KeyEvent>() {
        
        @Override public void handle(KeyEvent ke) {
            createLetter(ke.getText());
            ke.consume();
        }
    });
    // create press keys text
    pressText = new Text("Press Keys");
    pressText.setTextOrigin(VPos.TOP);
    pressText.setFont(new Font(Font.getDefault().getFamily(), 40));
    pressText.setLayoutY(5);
    pressText.setFill(Color.rgb(80, 80, 80));
    DropShadow effect = new DropShadow();
    effect.setRadius(0);
    effect.setOffsetY(1);
    effect.setColor(Color.WHITE);
    pressText.setEffect(effect);
    getChildren().add(pressText);
}
 
Example 8
Source File: SpaceRunnerApp.java    From FXGLGames with MIT License 5 votes vote down vote up
private void nextLevel() {
    uiTextLevel.setVisible(false);

    inc("level", +1);

    level = new Level();
    level.spawnNewWave();

    Text textLevel = getUIFactory().newText("Level " + geti("level"), Color.WHITE, 22);
    textLevel.setEffect(new DropShadow(7, Color.BLACK));
    textLevel.setOpacity(0);

    centerText(textLevel);
    textLevel.setTranslateY(250);

    addUINode(textLevel);

    animationBuilder()
            .interpolator(Interpolators.SMOOTH.EASE_OUT())
            .duration(Duration.seconds(1.66))
            .onFinished(() -> {
                animationBuilder()
                        .duration(Duration.seconds(1.66))
                        .interpolator(Interpolators.EXPONENTIAL.EASE_IN())
                        .onFinished(() -> {
                            removeUINode(textLevel);
                            uiTextLevel.setVisible(true);
                        })
                        .translate(textLevel)
                        .from(new Point2D(textLevel.getTranslateX(), textLevel.getTranslateY()))
                        .to(new Point2D(330, 540))
                        .buildAndPlay();
            })
            .fadeIn(textLevel)
            .buildAndPlay();
}
 
Example 9
Source File: GaussianBlurSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public static Node createIconContent() {

        Text sample = new Text("FX");
        sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,80));
        sample.setStyle("-fx-font-size: 80px;");
        sample.setFill(Color.web("#333333"));
        final GaussianBlur GaussianBlur = new GaussianBlur();
        GaussianBlur.setRadius(15);
        sample.setEffect(GaussianBlur);
        return sample;
    }
 
Example 10
Source File: InnerShadowSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public static Node createIconContent() {
    Text sample = new Text("FX");
    sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,80));
    sample.setStyle("-fx-font-size: 80px;");
    sample.setFill(Color.web("#aaaaaa"));
    final InnerShadow innerShadow = new InnerShadow();
    innerShadow.setRadius(4);
    innerShadow.setOffsetX(1);
    innerShadow.setOffsetY(1);
    innerShadow.setColor(Color.web("#333333"));
    sample.setEffect(innerShadow);
    return sample;
}
 
Example 11
Source File: ReflectionSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public static Node createIconContent() {
    Text sample = new Text("FX");
    sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,60));
    sample.setStyle("-fx-font-size: 80px;");
    sample.setFill(Color.web("#333333"));
    final Reflection reflection = new Reflection();
    reflection.setTopOffset(-28d);
    reflection.setFraction(0.5);
    sample.setEffect(reflection);
    return sample;
}
 
Example 12
Source File: KeyStrokeMotion.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public LettersPane() {
    setId("LettersPane");
    setPrefSize(480,480);
    setFocusTraversable(true);
    setOnMousePressed(new EventHandler<MouseEvent>() {
        
        @Override public void handle(MouseEvent me) {
            requestFocus();
            me.consume();
        }
    });
    setOnKeyPressed(new EventHandler<KeyEvent>() {
        
        @Override public void handle(KeyEvent ke) {
            createLetter(ke.getText());
            ke.consume();
        }
    });
    // create press keys text
    pressText = new Text("Press Keys");
    pressText.setTextOrigin(VPos.TOP);
    pressText.setFont(new Font(Font.getDefault().getFamily(), 40));
    pressText.setLayoutY(5);
    pressText.setFill(Color.rgb(80, 80, 80));
    DropShadow effect = new DropShadow();
    effect.setRadius(0);
    effect.setOffsetY(1);
    effect.setColor(Color.WHITE);
    pressText.setEffect(effect);
    getChildren().add(pressText);
}
 
Example 13
Source File: FxUtils.java    From stagedisplayviewer with MIT License 5 votes vote down vote up
public Text createLowerKey() {
    Text lowerKey = new Text();
    lowerKey.setFont(Font.font(FONT_FAMILY.toString(), FontWeight.MEDIUM, MAX_FONT_SIZE.toInt()));
    lowerKey.setFill(Color.WHITE);
    lowerKey.setWrappingWidth(getWrappingWidth());
    lowerKey.setTextAlignment(getAlignment());
    DropShadow ds = new DropShadow();
    ds.setOffsetY(0.0);
    ds.setOffsetX(0.0);
    ds.setColor(Color.BLACK);
    ds.setSpread(0.5);
    lowerKey.setEffect(ds);
    return lowerKey;
}
 
Example 14
Source File: GaussianBlurSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public static Node createIconContent() {

        Text sample = new Text("FX");
        sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,80));
        sample.setStyle("-fx-font-size: 80px;");
        sample.setFill(Color.web("#333333"));
        final GaussianBlur GaussianBlur = new GaussianBlur();
        GaussianBlur.setRadius(15);
        sample.setEffect(GaussianBlur);
        return sample;
    }
 
Example 15
Source File: InnerShadowSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public static Node createIconContent() {
    Text sample = new Text("FX");
    sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,80));
    sample.setStyle("-fx-font-size: 80px;");
    sample.setFill(Color.web("#aaaaaa"));
    final InnerShadow innerShadow = new InnerShadow();
    innerShadow.setRadius(4);
    innerShadow.setOffsetX(1);
    innerShadow.setOffsetY(1);
    innerShadow.setColor(Color.web("#333333"));
    sample.setEffect(innerShadow);
    return sample;
}
 
Example 16
Source File: ReflectionSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public static Node createIconContent() {
    Text sample = new Text("FX");
    sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,60));
    sample.setStyle("-fx-font-size: 80px;");
    sample.setFill(Color.web("#333333"));
    final Reflection reflection = new Reflection();
    reflection.setTopOffset(-28d);
    reflection.setFraction(0.5);
    sample.setEffect(reflection);
    return sample;
}
 
Example 17
Source File: FxmlImageManufacture.java    From MyBox with Apache License 2.0 5 votes vote down vote up
public static Image addTextFx(Image image, String textString,
        Font font, Color color, int x, int y, float transparent, int shadow) {
    try {
        Group group = new Group();

        Text text = new Text(x, y, textString);
        text.setFill(color);
        text.setFont(font);
        if (shadow > 0) {
            DropShadow dropShadow = new DropShadow();
            dropShadow.setOffsetX(shadow);
            dropShadow.setOffsetY(shadow);
            text.setEffect(dropShadow);
        }

        group.getChildren().add(text);

        Blend blend = new Blend(BlendMode.SRC_OVER);
        blend.setBottomInput(new ImageInput(image));
        blend.setOpacity(1.0 - transparent);
        group.setEffect(blend);

        SnapshotParameters parameters = new SnapshotParameters();
        parameters.setFill(Color.TRANSPARENT);
        WritableImage newImage = group.snapshot(parameters, null);
        return newImage;
    } catch (Exception e) {
        logger.error(e.toString());
        return null;
    }
}
 
Example 18
Source File: WhiteSkin.java    From Medusa with Apache License 2.0 4 votes vote down vote up
private void initGraphics() {
    // Set initial size
    if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 ||
        Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) {
        if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) {
            gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight());
        } else {
            gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    shadow     = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 12, 0, 3, 3);
    textShadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 4, 0, 2, 2);

    valueText = new Text(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getCurrentValue()));
    valueText.setFill(Color.WHITE);
    valueText.setFont(Fonts.robotoBold(PREFERRED_WIDTH * 0.20625));
    valueText.setTextOrigin(VPos.CENTER);
    valueText.relocate(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.46875);
    valueText.setEffect(textShadow);
    Helper.enableNode(valueText, gauge.isValueVisible());

    unitText  = new Text(gauge.getUnit());
    unitText.setFill(Color.WHITE);
    unitText.setFont(Fonts.robotoBold(PREFERRED_WIDTH * 0.0875));
    unitText.setTextOrigin(VPos.CENTER);
    unitText.relocate(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.65625);
    unitText.setEffect(textShadow);
    Helper.enableNode(unitText, !gauge.getUnit().isEmpty());

    backgroundRing = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5,
                             PREFERRED_WIDTH * 0.43125, PREFERRED_HEIGHT * 0.43125,
                             0, 360);
    backgroundRing.setFill(null);
    backgroundRing.setStroke(Color.rgb(255, 255, 255, 0.9));
    backgroundRing.setStrokeLineCap(StrokeLineCap.BUTT);
    backgroundRing.setStrokeWidth(PREFERRED_WIDTH * 0.1375);
    backgroundRing.setEffect(shadow);

    barBackground = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5,
                            PREFERRED_WIDTH * 0.43125, PREFERRED_HEIGHT * 0.43125,
                            0, 360);
    barBackground.setFill(null);
    barBackground.setStroke(Color.rgb(255, 255, 255, 0.4));
    barBackground.setStrokeLineCap(StrokeLineCap.BUTT);
    barBackground.setStrokeWidth(PREFERRED_WIDTH * 0.1375);

    bar = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5,
                  PREFERRED_WIDTH * 0.43125, PREFERRED_HEIGHT * 0.43125,
                  90, -gauge.getAngleStep() * gauge.getValue());
    bar.setFill(null);
    bar.setStroke(Color.WHITE);
    bar.setStrokeWidth(PREFERRED_WIDTH * 0.1375);
    bar.setStrokeLineCap(StrokeLineCap.BUTT);

    pane = new Pane(valueText, unitText, backgroundRing, barBackground, bar);
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth()))));

    getChildren().setAll(pane);
}
 
Example 19
Source File: RadarChart.java    From tilesfx with Apache License 2.0 4 votes vote down vote up
private void initGraphics() {
    stops = new ArrayList<>(16);
    for (Stop stop : getGradientStops()) {
        if (Double.compare(stop.getOffset(), 0.0) == 0) stops.add(new Stop(0, stop.getColor()));
        stops.add(new Stop(stop.getOffset() * 0.69924 + 0.285, stop.getColor()));
    }

    chartCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    chartCtx    = chartCanvas.getGraphicsContext2D();

    overlayCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    overlayCtx    = overlayCanvas.getGraphicsContext2D();

    unitText = new Text(getUnit());
    unitText.setTextAlignment(TextAlignment.CENTER);
    unitText.setTextOrigin(VPos.CENTER);
    unitText.setFont(Fonts.latoLight(0.045 * PREFERRED_WIDTH));

    legendStep = (getMaxValue() - getMinValue()) / 5d;
    dropShadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.BLACK, 5, 0, 0, 0);

    minValueText = new Text(String.format(Locale.US, formatString, getMinValue()));
    minValueText.setTextAlignment(TextAlignment.CENTER);
    minValueText.setTextOrigin(VPos.CENTER);
    minValueText.setVisible(isLegendVisible());
    minValueText.setEffect(dropShadow);

    legend1Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep));
    legend1Text.setTextAlignment(TextAlignment.CENTER);
    legend1Text.setTextOrigin(VPos.CENTER);
    legend1Text.setVisible(isLegendVisible());
    legend1Text.setEffect(dropShadow);

    legend2Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep * 2));
    legend2Text.setTextAlignment(TextAlignment.CENTER);
    legend2Text.setTextOrigin(VPos.CENTER);
    legend2Text.setVisible(isLegendVisible());
    legend2Text.setEffect(dropShadow);

    legend3Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep * 3));
    legend3Text.setTextAlignment(TextAlignment.CENTER);
    legend3Text.setTextOrigin(VPos.CENTER);
    legend3Text.setVisible(isLegendVisible());
    legend3Text.setEffect(dropShadow);

    legend4Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep * 3));
    legend4Text.setTextAlignment(TextAlignment.CENTER);
    legend4Text.setTextOrigin(VPos.CENTER);
    legend4Text.setVisible(isLegendVisible());
    legend4Text.setEffect(dropShadow);

    maxValueText = new Text(String.format(Locale.US, formatString, getMaxValue()));
    maxValueText.setTextAlignment(TextAlignment.CENTER);
    maxValueText.setTextOrigin(VPos.CENTER);
    maxValueText.setVisible(isLegendVisible());
    maxValueText.setEffect(dropShadow);

    // Add all nodes
    pane = new Pane(chartCanvas, overlayCanvas, unitText, minValueText, legend1Text, legend2Text, legend3Text, legend4Text, maxValueText);
    pane.setBackground(new Background(new BackgroundFill(getChartBackgroundColor(), new CornerRadii(1024), Insets.EMPTY)));

    getChildren().setAll(pane);
}
 
Example 20
Source File: RadarChart.java    From OEE-Designer with MIT License 4 votes vote down vote up
private void initGraphics() {
    stops = new ArrayList<>(16);
    for (Stop stop : getGradientStops()) {
        if (Double.compare(stop.getOffset(), 0.0) == 0) stops.add(new Stop(0, stop.getColor()));
        stops.add(new Stop(stop.getOffset() * 0.69924 + 0.285, stop.getColor()));
    }

    chartCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    chartCtx    = chartCanvas.getGraphicsContext2D();

    overlayCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    overlayCtx    = overlayCanvas.getGraphicsContext2D();

    unitText = new Text(getUnit());
    unitText.setTextAlignment(TextAlignment.CENTER);
    unitText.setTextOrigin(VPos.CENTER);
    unitText.setFont(Fonts.latoLight(0.045 * PREFERRED_WIDTH));

    legendStep = (getMaxValue() - getMinValue()) / 5d;
    dropShadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.BLACK, 5, 0, 0, 0);

    minValueText = new Text(String.format(Locale.US, formatString, getMinValue()));
    minValueText.setTextAlignment(TextAlignment.CENTER);
    minValueText.setTextOrigin(VPos.CENTER);
    minValueText.setVisible(isLegendVisible());
    minValueText.setEffect(dropShadow);

    legend1Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep));
    legend1Text.setTextAlignment(TextAlignment.CENTER);
    legend1Text.setTextOrigin(VPos.CENTER);
    legend1Text.setVisible(isLegendVisible());
    legend1Text.setEffect(dropShadow);

    legend2Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep * 2));
    legend2Text.setTextAlignment(TextAlignment.CENTER);
    legend2Text.setTextOrigin(VPos.CENTER);
    legend2Text.setVisible(isLegendVisible());
    legend2Text.setEffect(dropShadow);

    legend3Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep * 3));
    legend3Text.setTextAlignment(TextAlignment.CENTER);
    legend3Text.setTextOrigin(VPos.CENTER);
    legend3Text.setVisible(isLegendVisible());
    legend3Text.setEffect(dropShadow);

    legend4Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep * 3));
    legend4Text.setTextAlignment(TextAlignment.CENTER);
    legend4Text.setTextOrigin(VPos.CENTER);
    legend4Text.setVisible(isLegendVisible());
    legend4Text.setEffect(dropShadow);

    maxValueText = new Text(String.format(Locale.US, formatString, getMaxValue()));
    maxValueText.setTextAlignment(TextAlignment.CENTER);
    maxValueText.setTextOrigin(VPos.CENTER);
    maxValueText.setVisible(isLegendVisible());
    maxValueText.setEffect(dropShadow);

    // Add all nodes
    pane = new Pane(chartCanvas, overlayCanvas, unitText, minValueText, legend1Text, legend2Text, legend3Text, legend4Text, maxValueText);
    pane.setBackground(new Background(new BackgroundFill(getChartBackgroundColor(), new CornerRadii(1024), Insets.EMPTY)));

    getChildren().setAll(pane);
}