medusa icon indicating copy to clipboard operation
medusa copied to clipboard

Gauge INDICATOR graphic anomalies on extreme value changes

Open DJViking opened this issue 6 years ago • 7 comments

We have seen strange visual anomalies on Gauge with SkinType INDICATOR when the values have been updated constantly with extreme values beyond the minValue/maxValue range.

With setValueVisible(true), the value pops up different places around the Gauge.

We are using the Gauge INDICATOR as an carrier offset meter.

screenshot_20180604_091421 screenshot_20180604_091444 screenshot_20180604_091410 screenshot_20180604_091123 screenshot_20180604_091148 screenshot_20180604_090719

I have populated the test with some of the values we got in our application on Gauge. Example GaugeTest:

import java.util.Timer;
import java.util.TimerTask;

import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.stage.Stage;

import eu.hansolo.medusa.Gauge;
import eu.hansolo.medusa.Gauge.SkinType;
import eu.hansolo.medusa.GaugeBuilder;

public class GaugeTest extends Application {

    public static void main(String[] args) {
        GaugeTest.launch(args);
    }

    @Override
    public void start(Stage stage) throws Exception {
        VBox root = new VBox();
        Gauge instance = GaugeBuilder.create()
                .skinType(SkinType.INDICATOR)
                .areasVisible(true)
                .sectionsVisible(true)
                .decimals(2)
                .build();

        instance.setMaxValue(500.0);
        instance.setMinValue(-500.0);
        instance.setBarColor(Color.web("#d3d3d3"));
        instance.setBarBackgroundColor(Color.web("#d3d3d3"));

        instance.setValueVisible(true);
        instance.setValue(-1.0859123151620442E15);

        root.getChildren().add(instance);

        Platform.setImplicitExit(true);
        stage.setScene(new Scene(root));
        stage.setWidth(650);
        stage.setHeight(650);
        stage.setTitle("GaugeTest App");
        stage.show();

        TimerTask timerTask = new TimerTask() {
            private int count = 0;

            @Override
            public void run() {
                Platform.runLater(() -> {
                    if (count == 0) {
                        instance.setValue(1303.1762704840842);
                    } else if (count == 0) {
                        instance.setValue(901.0279253926457);
                    } else if (count == 1) {
                        instance.setValue(304.7297527629474);
                    } else if (count == 2) {
                        instance.setValue(-1.0859123151603925E15);
                    } else if (count == 3) {
                        instance.setValue(-1.0859123151606368E15);
                    } else if (count == 4) {
                        instance.setValue(1674.082843354779);
                    } else if (count == 5) {
                        instance.setValue(-1.0859123151619634E15);
                    } else if (count == 6) {
                        instance.setValue(858.203589043986);
                    } else if (count == 7) {
                        instance.setValue(1495.4797707702455);
                    } else if (count == 8) {
                        instance.setValue(5.387517262147369);
                    } else if (count == 9) {
                        instance.setValue(187.5197189495579);
                    } else if (count == 10) {
                        instance.setValue(1225.2107000621193);
                    } else if (count == 11) {
                        instance.setValue(281.00658981834385);
                    } else if (count == 12) {
                        instance.setValue(-1.0859123151624769E15);
                    } else if (count == 13) {
                        instance.setValue(2091.5190513029193);
                    } else if (count == 14) {
                        instance.setValue(748.2662023170526);
                    } else if (count == 15) {
                        instance.setValue(-1.0859123151612928E15);
                    } else if (count == 16) {
                        instance.setValue(1850.4501956466806);
                    } else if (count == 17) {
                        instance.setValue(-1.0859123151618832E15);
                    } else if (count == 18) {
                        instance.setValue(1595.6434090479158);
                    } else if (count == 19) {
                        instance.setValue(-1.0859123151620781E15);
                    } else if (count == 20) {
                        instance.setValue(1774.4972164417966);
                    } else if (count == 21) {
                        instance.setValue(1468.5796625829053);
                    } else if (count == 22) {
                        instance.setValue(116.07600419054035);
                    } else if (count == 23) {
                        instance.setValue(-1.0859123151601659E15);
                    } else if (count == 24) {
                        instance.setValue(1227.4038484404773);
                    } else if (count == 25) {
                        instance.setValue(1034.8424890538386);
                    }
                    count++;
                });

            }
        };

        new Timer().scheduleAtFixedRate(timerTask, 1000, 1500);
    }

}

DJViking avatar Jun 04 '18 07:06 DJViking

I've made a fix to the problem with commit 1d7f07c993d37109efcceb091d48e97babbfd9df Could you please give it a try and let me know if this works for you?

HanSolo avatar Jun 07 '18 08:06 HanSolo

It worked better, but there is still a problem with rendering of the needle. It is sometime not shown when it goes from one end to the other with values beyond minValue/maxValue.

The needle was missing on max, mostly only when value was way above maxValue, but not always. Sometime when the value was above max the needle was shown.

value=-3565.1111 (needle shown) value=700.3343 (needle is not shown)

value=244.5433 (needle shown) value=700.3342 (needle is shown)

value=-505.000 (needle is shown) value=700.3343 (needle is not shown)

The same happens in reverse value=700.3343 (needle is shown) value=-700.3343 (needle is not shown)

DJViking avatar Jun 08 '18 09:06 DJViking

Hmm...that's interesting...neither with the values from the original issue nor with the values you provided in the last comment the needle will disappear on my mac??? So I always see the needle in the center of the gauge where it should be. Can you provide some information about your environment please?

HanSolo avatar Jun 08 '18 10:06 HanSolo

Also modified the tooltip location a little bit with the last commit

HanSolo avatar Jun 08 '18 11:06 HanSolo

Running OpenSUSE Leap 42.3 KDE Plasma 5 Intel graphics Java 8

I think it was running with the JavaFX software pipeline: -Dprism.order=sw Unsure if gtk3 was enabled or not with -Djdk.gtk.version=3. I have to check when I'm back at work on Monday. Perhaps try with/without either of these settings. Until then I will try running the test application at my home computer tomorrow, where I am running the same Linux distribution, but it has better NVIDIA graphics. I will also try running it with Java 10.

Should the needle be at the center(top) position if the value is outside of minValue/maxValue? I see that the needle is at bottom left side if value is lower than minValue and bottom right side if value is higher than maxValue. When the needle goes from one side to the next it is disappeared.

DJViking avatar Jun 08 '18 16:06 DJViking

Ok so I did not test it using the software renderer but it would explain the difference. In case the value is smaller than the min value the needle should stick to the min value and if it is larger than the max value the needle should stick to the max value. This is really strange because like mentioned before I can't reproduce yet but will also try with the software renderer on my other linux system.

HanSolo avatar Jun 08 '18 16:06 HanSolo

I don't think the problem is either the SW or HW renderer. I get same behaviour on either. I built a JAR of Medusa from master branch that contains your latest commits.

With Java 8 the needle was placed on the side of the Gauge and not on the Gauge. What I experienced previously on my work computer was that the needle disappeared. The value labels where in the correct place though at the tip of the needle.

With Java 10 I got the needle to stay in the correct place and not disappear. Though the value labels where no longer placed at the tip of the needle, but all over the place. The gauge was no longer a half circle of 180 degrees. According to the value above maxValue the circle could extend all the way to 360 degrees.

Made some recordings that shows this, attached two both with the es2 HW renderer. First recording: Java 8u172 Second recording: Java 10 recordings.zip

DJViking avatar Jun 09 '18 10:06 DJViking