private void resizeText() {        
        value.setFont(Font.font("Open Sans", FontWeight.BOLD, size * 0.145));
        if (value.getLayoutBounds().getWidth() > 0.38 * size) {
            double decrement = 0d;
            while (value.getLayoutBounds().getWidth() > 0.38 * size && value.getFont().getSize() > 0) {
                value.setFont(Font.font("Open Sans", FontWeight.BOLD, size * (0.15 - decrement)));
                decrement += 0.01;
            }
        }
        value.setTranslateX((size - value.getLayoutBounds().getWidth()) * 0.5);
        value.setTranslateY(size * (title.getText().isEmpty() ? 0.5 : 0.48));

        title.setFont(Font.font("Open Sans", FontWeight.BOLD, size * 0.045));
        if (title.getLayoutBounds().getWidth() > 0.38 * size) {
            double decrement = 0d;
            while (title.getLayoutBounds().getWidth() > 0.38 * size && title.getFont().getSize() > 0) {
                title.setFont(Font.font("Open Sans", FontWeight.BOLD, size * (0.05 - decrement)));
                decrement += 0.01;
            }
        }
        title.setTranslateX((size - title.getLayoutBounds().getWidth()) * 0.5);
        title.setTranslateY(size * 0.5 + value.getFont().getSize() * 0.7);
    }