HanSolo / medusa

A JavaFX library for Gauges
Apache License 2.0
688 stars 129 forks source link

Slim Gauge not being filled in properly #156

Closed dpelego closed 5 years ago

dpelego commented 5 years ago

The following code is the gauge being set up:

    GaugeBuilder builder = GaugeBuilder.create().skinType(Gauge.SkinType.SLIM);

    overallGauge = builder.decimals(0).maxValue(overall).unit("Tickets").build();

    overallGauge.setValue(overall);

Which results in the following:

image

The current value is equal to the max value (402/402), so shouldn't the gauge be completely full? If I set the max value to something lower, say 300, the gauge (402/300) looks full but only displays 300 as the value.

image

Is this a bug? If not, what can I do to make the gauge fill up properly?

HanSolo commented 5 years ago

I've tried with an older version and saw the same effect but when I use the current code from the repository it works just fine. Here is the code I used to test it:

gauge = GaugeBuilder.create().skinType(Gauge.SkinType.SLIM)
                                     .decimals(0)
                                     .maxValue(402)
                                     .unit("Tickets")
                                     .value(402)
                                     .build();

And this is the result...so it looks ok to me... image

HanSolo commented 5 years ago

I've just checked using the medusa 8.0 jar and again see the problem...will investigate why that happens...

dpelego commented 5 years ago

If it helps, I tried using the code you provided and received the same issue. I'm using the latest version (8.0) from a Maven dependency (https://mvnrepository.com/artifact/eu.hansolo/Medusa/8.0), although that shouldn't matter.

Thank you for looking into this, and also thank you for making such a beautiful library. For now I've made the bar overlay the same color as the bar background and am continuing to use the gauges since they look so great.

HanSolo commented 5 years ago

Ok...I've found the problem, not sure why it happens in the jar and not in the pure code but if you set autoscale to false it will work. Autoscale will set the max value automatically to 450 which explains the gap. Nevertheless on my machine the jar library behaves differently from the pure source code where I don't know why this is the case. I hope you can work with this workaround until I'll have found the real problem here? Cheers, Gerrit

dpelego commented 5 years ago

I set autoscale to false and it works great. Thank you very much for the help Gerrit!

(I'm not sure if you want to leave this Open or Closed so I'm not going to close it for now)