03-25-2022 04:41 PM
I want a wide graphical numeric indicator with a color ramp. Something like this:
Meters have color ramps, but their aspect ratio is not changeable.
A slider can have any aspect ratio, but it can't have a color ramp.
Has anyone already built a custom control that's like a slider but with a color ramp?
Solved! Go to Solution.
03-27-2022 06:09 PM
What do you mean by meters' "aspect ratio is not changeable"? I can change the width and height of the color part of a meter in a way that seems similar (to me, anyway) to how I can resize a slider.
(I'm not a graphics guy, so bear with me if there is nuance to your question I'm not getting)
03-28-2022 12:08 AM - edited 03-28-2022 12:09 AM
I guess perhaps that the meter doesn't allow individually changing the width or height?
This means (as far as I can see, also not a "graphics guy") that you're constrained to having a ramp that is circular (rather than e.g. ellipsoidal). (Actually, maybe only the NXG style is circular, and the others are ellipsoidal, but in that case I'd adjust my comment to suggest that you can't adjust the ratio between the major and minor axes.)
It also looks like maybe the Meters can't adjust their min/max angles - for the NXG style I get ~180degrees, and for the others I see what you showed, maybe a bit less than 90 degrees?
03-28-2022 01:56 AM - edited 03-28-2022 01:59 AM
He likely means the fact that the housing size of the meter only can be changed in the same way as other elements when you press the shift button, and that not even fully, with shift button pressed you can expand an object in horzontal or vertical way only and in a way that maintains the width/height aspect ratio. This last one can be very handy when trying to resize a round LED to avoid turning it into an ellipsoid.
It's actually even more sneaky. In customize mode you can resize the backrground in any way you want but the meter area is the one that limits the resizing to maintain the aspect ratio.
03-28-2022 09:31 AM
@Darren wrote:
What do you mean by meters' "aspect ratio is not changeable"? I can change the width and height of the color part of a meter in a way that seems similar (to me, anyway) to how I can resize a slider.
(I'm not a graphics guy, so bear with me if there is nuance to your question I'm not getting)
When I say that the "aspect ratio is not changeable" what I really mean is that the aspect ratio is not changeable. I.e. when I change the size, both the height and width change simultaneously, and the ratio of height to width (the aspect ratio) remains the same.
I want to make a meter that is wider, but not higher.
03-29-2022 06:51 AM
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...
03-29-2022 10:18 AM
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.
My guess is that the reason for the limitation is that the pointer is made by having a line segment pivot at a point; which means that its tip always follows a circular arc. If the scale were stretched into an elliptical arc, the tip of the pointer wouldn't stay on the scale. It would be possible to scale it in such a manner that the arc is always circular (by changing the angle covered); but they probably didn't want to spend the effort on something that most people won't care about.
I ended up making an XControl. Since I only need 3 colors (under range, in range, over range), I used a horizontal slider with 3 pointers: One for the indicator, and 2 invisible ones with fill colors for over/under range.
03-29-2022 04:12 PM
there lives the classic color ramp control in the classic palette
however, this can be combined only with a vertical not a horizontal slider...
03-30-2022 04:16 AM - edited 03-30-2022 04:18 AM
@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?
03-30-2022 05:55 AM
Hi Paul,
@paul_cardinale wrote:
Can't just put an image on the background because I need the ramp data to be updated from a DB.
Once I used an array of colorboxes to simulate a colorramp. You can make those colorboxes very small (in width or height). Then I added some VIs to create different kind of colorramps…