LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with Custom Needle Image Rotation on Speedometer Gauge

Hi everyone,
I am trying to customize a standard LabVIEW Speedometer/Gauge control by replacing the default needle with a custom image, but I'm running into a rotation logic issue.
The Problem:
When I import my custom image (originally 12x150 px) onto the needle part in the Control Editor, the needle moves along the gauge arc but stays vertically static—it doesn’t rotate to point at the numbers.
What I've Tried:
I followed the common advice of placing the needle on a transparent square canvas (300x300 px) with the base of the needle positioned at the exact center (150, 150) to create a pivot point.

I want the custom image to behave like a standard vector needle where the base stays fixed at the gauge center and the tip rotates to indicate the values.
Any advice or example .ctl files would be greatly appreciated!
 
Screenshot 2026-04-22 172855.png

0 Kudos
Message 1 of 9
(206 Views)

Why not start with a Gauge control?  You can easily change the lower and upper limits, and make the lower and upper limits, say, 0 and 100 (mph).

 

Bob Schor

0 Kudos
Message 2 of 9
(174 Views)

You can't do this directly, because LV doesn't know how to rotate your image. The original needle is a line-type PICC (a custom vector image format that LV uses internally) and that's the only thing that LV knows how to rotate in this context. You can customize the gauge and replace the needle with another line-type PICC, such as the arrow, but not with your custom image.

 

If you do want your own image, you can use a picture control on top of your gauge and use the picture control functions to rotate your image, but that comes with a few caveats:

 

  1. I believe the picture control still doesn't support alpha transparency for the images that it shows. It's possible to get an image of the background yourself and do the blending on a pixel by pixel basis, essentially redrawing the gauge from scratch. This will probably require you to hide the picture control at least once to get the background image. If you have other things there which are changing constantly, you might need to repeatedly defer updates, hide, get the image and undefer.
  2. You would need to account for the relevant transformations and rotations and calculating the scale so that your needle is shown correctly.
  3. The performance for it might not be great and it might look pixelated.

 

People have all kinds of work on customized gauges. I suggest you look around. It might also be possible to use a .NET or HTML control, where you might have more customization options


___________________
Try to take over the world!
Message 3 of 9
(131 Views)

Hi, Bob_Schor,

The main issue is to customize the needle for gauge control in which i am facing problem. So if you have any suggestion for this problem it will be helpful for me. 

0 Kudos
Message 4 of 9
(117 Views)

Hi Abhishek,

 


@Abhishek_Dass wrote:

So if you have any suggestion for this problem it will be helpful for me. 


Do what tst suggested to you…

 

Once I had a similar problem and I ended up using a XYgraph:

  • I placed the image of a (car) speedometer as background image
  • I used a plot with a thick line as needle.
  • I adjusted the XY scales so the needle was moving in the correct positions.

(You can hide all the functionality inside a XControl…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 9
(110 Views)

Hi tst,

Thank you for the suggestion. I have one more question: is it possible to create a customized line-type PICC for needle that I want ? I am relatively new to LabVIEW and still gaining experience, so my current knowledge is limited. I am learning primarily through hands-on project work.

0 Kudos
Message 6 of 9
(98 Views)

Hi GerdW,

 

Thank you for your suggestion. If possible, could you please share the VI implementation of your idea using the XY Graph?

0 Kudos
Message 7 of 9
(93 Views)

@Abhishek_Dass wrote:

Hi tst,

Thank you for the suggestion. I have one more question: is it possible to create a customized line-type PICC for needle that I want ? I am relatively new to LabVIEW and still gaining experience, so my current knowledge is limited. I am learning primarily through hands-on project work.


Not really. The PICC format is LabVIEW proprietary. It is similar to the Macintosh PICT format but not the same, since NI had to create their own routines anyhow for non MacOS versions of LabVIEW. There is AFAIK no editor outside of NI that could create the necessary resource format and I found never enough motivation to try to reverse engineer such an archaic feature.

It is also quite unlikely that NI would even spend any effort to create new PICCs nowadays. The software routines to handle them are there, but they were developed 35 years ago at a time when the LabVIEW developers were fighting for virtually every byte that could be saved. That code is accordingly arcane, difficult to maintain and almost impossible to modify by modern software developers who are used to very different architectural and structural designs. The Custom Control Editor to manipulate these controls is quirky and has strange artefacts when dealing with such PICC (and other) resources.

 

And yes, LabVIEW also supports WMF and EMF formats which are the Windows equivalent of PICT. However WMF is highly limited and has many quirks that were interpreted differently by different software packages and even between different Windows versions. EMF was an attempt to standardize it and extend the format to allow for coordinates beyond 16 bit size but still had quite some quirks and there were only very few applications supporting the use of that format. The Windows GDI still supports it, but due to its rare use I would not be surprised if it has bitrotted since. I don't believe that LabVIEW tries to convert EMF to PICC in any way, so if you use EMF resources in your controls or frontpanel they usually end up as empty rectangles on non-Windows systems. And you have similar quirks in the Control Editor with EMF resources as you have with PICC or PICT resources when trying to manipulate them in any way.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 8 of 9
(73 Views)

@rolfk wrote:

@Abhishek_Dass wrote:

Hi tst,

Thank you for the suggestion. I have one more question: is it possible to create a customized line-type PICC for needle that I want ? I am relatively new to LabVIEW and still gaining experience, so my current knowledge is limited. I am learning primarily through hands-on project work.


Not really. The PICC format is LabVIEW proprietary. It is similar to the Macintosh PICT format but not the same, since NI had to create their own routines anyhow for non MacOS versions of LabVIEW. There is AFAIK no editor outside of NI that could create the necessary resource format and I found never enough motivation to try to reverse engineer such an archaic feature.

It is also quite unlikely that NI would even spend any effort to create new PICCs nowadays. The software routines to handle them are there, but they were developed 35 years ago at a time when the LabVIEW developers were fighting for virtually every byte that could be saved. That code is accordingly arcane, difficult to maintain and almost impossible to modify by modern software developers who are used to very different architectural and structural designs. The Custom Control Editor to manipulate these controls is quirky and has strange artefacts when dealing with such PICC (and other) resources.

 

And yes, LabVIEW also supports WMF and EMF formats which are the Windows equivalent of PICT. However WMF is highly limited and has many quirks that were interpreted differently by different software packages and even between different Windows versions. EMF was an attempt to standardize it and extend the format to allow for coordinates beyond 16 bit size but still had quite some quirks and there were only very few applications supporting the use of that format. The Windows GDI still supports it, but due to its rare use I would not be surprised if it has bitrotted since. I don't believe that LabVIEW tries to convert EMF to PICC in any way, so if you use EMF resources in your controls or frontpanel they usually end up as empty rectangles on non-Windows systems. And you have similar quirks in the Control Editor with EMF resources as you have with PICC or PICT resources when trying to manipulate them in any way.


You are such a wealth of knowledge. Never EVER leave this forum!

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 9 of 9
(25 Views)