code: private void resizeDynamicText() {
          double maxWidth = unitText.isManaged() ? size * 0.725 : size * 0.9;
          double fontSize = size * 0.24;
          valueText.setFont(Fonts.latoRegular(fontSize));
          if (valueText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(valueText, maxWidth, fontSize); }
  
          maxWidth = size * 0.15;
          fontSize = size * 0.06;
          unitText.setFont(Fonts.latoRegular(fontSize));
          if (unitText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(unitText, maxWidth, fontSize); }
          if (unitText.isVisible()) {
              valueText.relocate((size - valueText.getLayoutBounds().getWidth() - unitText.getLayoutBounds().getWidth()) * 0.5, size * 0.15);
              unitText.relocate(valueText.getLayoutX() + valueText.getLayoutBounds().getWidth() + size * 0.025, size * 0.3275);
          } else {
              valueText.relocate((size - valueText.getLayoutBounds().getWidth()) * 0.5, size * 0.15);
          }
  
          if (sectionsVisible) {
              fontSize = size * 0.08;
              thresholdText.setFont(Fonts.latoRegular(fontSize));
              thresholdText.setTextOrigin(VPos.CENTER);
              if (thresholdText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(thresholdText, maxWidth, fontSize); }
              thresholdText.setX((size - thresholdText.getLayoutBounds().getWidth()) * 0.5);
              thresholdText.setY(thresholdRect.getLayoutBounds().getMinY() + thresholdRect.getHeight() * 0.5);
          }
      }
docs: ******************** Resizing ******************************************