HanSolo / medusa

A JavaFX library for Gauges
Apache License 2.0
694 stars 131 forks source link

Anatomy of Gauge #183

Open sp33dy opened 4 years ago

sp33dy commented 4 years ago

Hi,

I really love this library, THANK YOU! It's got a lot of potential for me. However, I'm struggling with the anatomy of each of the options, but I'm working through the difference between a section, area and markers for example. I don't suppose you could pop up a simple diagram of this? Although I might have figured it out by playing with it.

My second question is whether you can answer if my requirement can be met by this library?

I want to implement a cross between the dashboard and the indicator; couple with a range from -100 to 100. I want the bar to grow red when it goes negative and grow green when positive.

I see I can set ranges in the background, but I don't seem to be able to influence the bar colour as it grows left or right. Is this even possible?

Kind regards

Carl

HanSolo commented 4 years ago

Hi there, you might want to check my blog for more information: https://harmoniccode.blogspot.com/search?q=Medusa&m=1 In addition there is also a Medusa Demo project on github that shows all kind gauges and in the code you can see how it was done. For your second question I can only answer that yes you can change the color in the way you want but you might want to add a little sketch of your vision here so that I can better see what you are planning to do.

sp33dy commented 4 years ago

Ah, thanks for getting back to me. Had a good play last night and starting to get a hang of what it is capable of; looking at the code is useful! Thanks for the Blog, that didn't appear in my searching and I can see what I need there that will help with the Anatomy.

As for my second question:

image

A badly drawn diagram. Effectively I want to start at 0.0 and then move the needle CCW (Red) or CW (Green) and show the label for the amount.

HanSolo commented 4 years ago

Sorry for the late reply but I was quite busy. So for that requirement you could either create a custom skin that only draws what you need or use areas in the standard gauge skin. There are properties to highlight a section/area when the needle is over it. With this you could create an area from -45 to 0 in red and an area from 0 to 45. If you need to always visualize the value from 0 to the current needle position in either red when negative or green when positive you should better create a new skin based on the GaugeSkin.