03-30-2022 07:55 AM
I'd probably look at creating a 2D picture. I did a quick test and getting a gradient scale and a line as needle was simple enough.
03-30-2022 08:01 AM
wiebe@CARYA wrote:
@paul_cardinale wrote:
wiebe@CARYA wrote:
I suppose the logic is that these meters resemble physical meters, and as the needle makes a circle, the meter has to stay to ratio...
You can replace a slider's background with a gradient decoration (2 colors only):
Or a custom PNG (pixelated)...
Otherwise I guess you'll have to use a picture control and\or an XControl...
Can't just put an image on the background because I need the ramp data to be updated from a DB.
So... Even if the ratio wasn't fixed, you couldn't have used the meter? 🙄
Or is there a way to dynamically change the colors of the meter?
Yes, the color ramp of a meter is changeable:
04-14-2022 12:05 PM - edited 04-14-2022 12:12 PM
I might have just the thing you are looking for. This is a Meter Picture class that I intended on turning into a XControl or QControl but never got around to it. You give it the color range and colors, then it creates a meter that has gradient colors for the ranges you picked. You can then set the value, or resize the control and it creates a 2D Picture control showing the meter and value. It doesn't work in all sizes but I think it does a decent job and you can adjust it as needed.
I tried to keep performance decent, by only redrawing the things that are needed. So the gradients aren't re created if only the value changes for instance. Oh and documentation was never finished. I think the 3 main functions are pretty self explanatory, but I can't honestly remember how I did all the math. I'm guessing parts of it were pulled from other posts found on the forums.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
04-14-2022 01:14 PM
@Hooovahh wrote:
I might have just the thing you are looking for. This is a Meter Picture class that I intended on turning into a XControl or QControl but never got around to it.
Indeed a nice little picture class. This was exactly what I was thinking of when reading the original post. Well done.
If he needs it to be wider, just increase the radius a little bit. I like how the color ramp is a bunch of lines, but when you make the meter big (huuuge) you can see the aliasing and whitespace in between. I won't take a star off for that, though.
04-19-2022 03:17 AM
Could you save this for 19?
Thanks
04-19-2022 09:29 AM
Here it is in 2018 SP1. I rearranged the project a little and set the comment font so it would not exceed its bounds. No code changes.
04-26-2022 02:14 PM
This is what I came up with.