I'm trying to use the LCD gauges in Jfxtras. Here's the code that I have to create the gauge:
final Gauge lcd = GaugeBuilder.create()
.gaugeType(GaugeBuilder.GaugeType.LCD)
.lcdDesign(LcdDesign.DARKAMBER)
.prefWidth(200)
.prefHeight(85)
.maxValue(9999)
.build();
I'm then setting the value of the gauge like this:
Platform.runLater( new Runnable() {
@Override
public void run() {
lcd.setValue(245);
}
});
No matter what I do, the maximum value displayed seems to always be 100. Is there any way for me to override this and display a different max value?
Ok - I had given up on this initially and made my own very ugly looking display, but just couldn't keep from digging further.
I checked out and built the jfxtras-labs source and found my issue.
In the constructor of:
jfxtras.labs.scene.control.gauge.GaugeModel
there is a private and unmodifiablescale
property:private ObjectProperty<LinearScale> scale;
It is hard coded to be initialized to have a min of 0 and a max of 100 in the default constructor.
scale = new SimpleObjectProperty<LinearScale>(new LinearScale(0, 100));
This constructor is used by both Gauge and Lcd.
At the moment, I haven't found any way to modify this property other than to change the source code.
Here's what I modified the above line to to resolve my issues:
scale = new SimpleObjectProperty<LinearScale>(new LinearScale(Integer.MIN_VALUE, Integer.MAX_VALUE));
The only down stream side-effect I observed from this is that after doing this, you'll need to set the min/max property when building the gauges otherwise the radial gauges become useless as their scale is unreadable.
I haven't seen any other issues, but that doesn't mean that I haven't introduced any. So use at your own risk.