If max value is being set dynamically after gauge is already initialized and visible it is causing problem with tick size not changed at the marks area. Need to recalculate ticks property according to the new max value.
Source code for the screenshot
`import eu.hansolo.medusa.Gauge;
import eu.hansolo.medusa.GaugeBuilder;
import javafx.animation.AnimationTimer;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import java.util.Random;
public class TestGauge extends Application {
private static final Random RND = new Random();
private Gauge gauge;
private long lastTimerCall;
private AnimationTimer timer;
public static void main(String[] args) {
launch(args);
}
@Override
public void init() {
gauge = GaugeBuilder.create()
.prefSize(250, 250).build();
lastTimerCall = System.nanoTime();
timer = new AnimationTimer() {
@Override public void handle(final long now) {
if (now > lastTimerCall + 2_000_000_000L) {
gauge.setValue(RND.nextDouble() * 100);
gauge.setMaxValue(RND.nextDouble() * 1000);
lastTimerCall = now;
}
}
};
timer.start();
}
@Override
public void start(Stage stage) {
StackPane pane = new StackPane(gauge);
Scene scene = new Scene(pane);
stage.setTitle("Dynamic values Demo");
stage.setScene(scene);
stage.show();
}
@Override
public void stop() {
System.exit(0);
}
If max value is being set dynamically after gauge is already initialized and visible it is causing problem with tick size not changed at the marks area. Need to recalculate ticks property according to the new max value.
Source code for the screenshot `import eu.hansolo.medusa.Gauge; import eu.hansolo.medusa.GaugeBuilder; import javafx.animation.AnimationTimer; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.layout.StackPane; import javafx.stage.Stage;
import java.util.Random;
public class TestGauge extends Application { private static final Random RND = new Random(); private Gauge gauge; private long lastTimerCall; private AnimationTimer timer;
} `