HanSolo / medusa

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

counter-clockwise gauge #220

Open robbiezl opened 1 year ago

robbiezl commented 1 year ago

Now, because of the value clamp,the gauge can only support clockwise graphical representation. When the value is negative, could you provide counterclockwise representation

HanSolo commented 1 year ago

Can you provice a graphical example about what you are looking for please?

robbiezl commented 1 year ago

Thank you for your reply. The following is the URL of the sketch I uploaded

https://pan.baidu.com/s/1V7Ap_iySwf1wZ10I8L99WA?pwd=7hxy

input code: 7hxy

HanSolo commented 1 year ago

Looks like I have only implemented it in the GaugeSkin.

Gauge gauge = GaugeBuilder.create()
                          .skinType(SkinType.GAUGE)
                          .minValue(-100)
                          .maxValue(0)
                          .tickLabelDecimals(1)
                          .startAngle(90)
                          .angleRange(270)                    
                          .decimals(2)
                          .autoScale(false)
                          .animated(true)                    
                          .build();

If that skin doesn't work for you, I'm afraid you need to implement it on your own (which is not too hard, depending on the skin you choose as base). If you take the BarSkin you don't need to worry about the tickmarks which is the most work to get it right. So you could create either a new skin based on the BarSkin or create a pull request with the changes.

robbiezl commented 1 year ago

Maybe my expression is not accurate enough. I want the value progress bar to express positive and negative through positive or clockwise.Now when the value is negative, the progress bar is always displayed at 0.

robbiezl commented 1 year ago

Maybe my expression is not accurate enough. I want the value progress bar to express positive and negative through positive or clockwise.Now when the value is negative, the progress bar is always displayed at 0.

robbiezl commented 1 year ago

Maybe my expression is not accurate enough. I want the value progress bar to express positive and negative through positive or clockwise.Now when the value is negative, the progress bar is always displayed at 0.

            gauge = GaugeBuilder.create().interactive(true)
            .skinType(Gauge.SkinType.BAR)
            .barColor(Color.rgb(0, 255, 0))
            .valueColor(Color.BLACK)
            .unitColor(Color.BLACK)
            .unit("KPH")
            .animated(true).value(-75)
            .build();

链接: https://pan.baidu.com/s/1yD8hsbbbCpcQuCU0txP2GQ?pwd=kjgx

HanSolo commented 1 year ago

Yes, I understand but it is not implemented in the BarSkin, so it only works in the GaugeSkin at the moment. Because I'm busy with other stuff, I won't have the time to implement it at the moment. But as mentioned for the BarSkin it should not be too hard to implement it on your own and either use your own skin based on the BarSkin or creeate a pull request which might end up in Medusa.