use of javafx.scene.layout.Background in project tilesfx by HanSolo.
the class SmoothedChart method setSeriesColor.
public void setSeriesColor(final XYChart.Series<X, Y> SERIES, final Paint STROKE, final Paint FILL, final Paint LEGEND_SYMBOL_FILL) {
Background symbolBackground = new Background(new BackgroundFill(STROKE, new CornerRadii(1024), Insets.EMPTY), new BackgroundFill(Color.WHITE, new CornerRadii(1024), new Insets(2)));
setSeriesColor(SERIES, STROKE, FILL, symbolBackground, LEGEND_SYMBOL_FILL);
}
use of javafx.scene.layout.Background in project tilesfx by HanSolo.
the class SunburstChart method redraw.
public void redraw() {
pane.setBackground(new Background(new BackgroundFill(backgroundPaint, CornerRadii.EMPTY, Insets.EMPTY)));
pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(borderWidth / PREFERRED_WIDTH * size))));
segmentPane.setBackground(new Background(new BackgroundFill(getBackgroundColor(), CornerRadii.EMPTY, Insets.EMPTY)));
segmentPane.setManaged(isInteractive());
segmentPane.setVisible(isInteractive());
drawChart();
}
use of javafx.scene.layout.Background in project tilesfx by HanSolo.
the class PercentageTileSkin method initGraphics.
// ******************** Initialization ************************************
@Override
protected void initGraphics() {
super.initGraphics();
barColor = tile.getBarColor();
barBackground = new Region();
barBackground.setBackground(new Background(new BackgroundFill(tile.getBarBackgroundColor(), new CornerRadii(0.0, 0.0, 0.025, 0.025, true), Insets.EMPTY)));
barClip = new Rectangle();
bar = new Rectangle();
bar.setFill(tile.getBarColor());
bar.setStroke(null);
bar.setClip(barClip);
titleText = new Text();
titleText.setFill(tile.getTitleColor());
Helper.enableNode(titleText, !tile.getTitle().isEmpty());
valueText = new Text(String.format(locale, formatString, ((tile.getValue() - minValue) / range * 100)));
valueText.setFill(tile.getValueColor());
Helper.enableNode(valueText, tile.isValueVisible());
unitText = new Text(tile.getUnit());
unitText.setFill(tile.getUnitColor());
Helper.enableNode(unitText, !tile.getUnit().isEmpty());
valueUnitFlow = new TextFlow(valueText, unitText);
valueUnitFlow.setTextAlignment(TextAlignment.RIGHT);
description = new Label(tile.getDescription());
description.setAlignment(tile.getDescriptionAlignment());
description.setWrapText(true);
description.setTextFill(tile.getTextColor());
Helper.enableNode(description, !tile.getDescription().isEmpty());
percentageText = new Text();
percentageText.setFill(tile.getBarColor());
percentageUnitText = new Text("%");
percentageUnitText.setFill(tile.getBarColor());
maxValueRect = new Rectangle();
maxValueRect.setFill(tile.getThresholdColor());
maxValueText = new Text();
maxValueText.setFill(tile.getBackgroundColor());
maxValueUnitText = new Text(tile.getUnit());
maxValueUnitText.setFill(tile.getBackgroundColor());
getPane().getChildren().addAll(barBackground, bar, titleText, valueUnitFlow, description, percentageText, percentageUnitText, maxValueRect, maxValueText, maxValueUnitText);
}
use of javafx.scene.layout.Background in project tilesfx by HanSolo.
the class PercentageTileSkin method redraw.
@Override
protected void redraw() {
super.redraw();
titleText.setText(tile.getTitle());
unitText.setText(tile.getUnit());
description.setText(tile.getDescription());
description.setAlignment(tile.getDescriptionAlignment());
percentageText.setText(String.format(locale, "%." + tile.getDecimals() + "f", tile.getValue() / range * 100));
maxValueText.setText(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", tile.getMaxValue()));
maxValueUnitText.setText(tile.getUnit());
resizeStaticText();
barBackground.setBackground(new Background(new BackgroundFill(tile.getBarBackgroundColor().brighter().brighter(), new CornerRadii(0.0, 0.0, tile.getRoundedCorners() ? size * 0.025 : 0.0, tile.getRoundedCorners() ? size * 0.025 : 0.0, false), Insets.EMPTY)));
barColor = tile.getBarColor();
if (sectionsVisible && !sections.isEmpty()) {
setBarColor(tile.getValue());
} else {
bar.setFill(barColor);
}
titleText.setFill(tile.getTitleColor());
unitText.setFill(tile.getUnitColor());
description.setTextFill(tile.getDescriptionColor());
maxValueText.setFill(tile.getBackgroundColor());
maxValueUnitText.setFill(tile.getBackgroundColor());
maxValueRect.setFill(Double.compare(tile.getCurrentValue(), maxValue) >= 0 ? barColor : tile.getThresholdColor());
valueText.setFill(tile.getValueColor());
unitText.setFill(tile.getUnitColor());
}
use of javafx.scene.layout.Background in project tilesfx by HanSolo.
the class RadarChart method resize.
// ******************** Private Methods ***********************************
private void resize() {
double width = getWidth() - getInsets().getLeft() - getInsets().getRight();
double height = getHeight() - getInsets().getTop() - getInsets().getBottom();
size = width < height ? width : height;
if (size > 0) {
pane.setMaxSize(size, size);
pane.relocate((getWidth() - size) * 0.5, (getHeight() - size) * 0.5);
pane.setBackground(new Background(new BackgroundFill(getChartBackgroundColor(), new CornerRadii(1024), Insets.EMPTY)));
chartCanvas.setWidth(size);
chartCanvas.setHeight(size);
overlayCanvas.setWidth(size);
overlayCanvas.setHeight(size);
redraw();
}
}
Aggregations