LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

rotating text labels programmatically

Is there a way to programmatically cause graph labels to appear rotated by 90 degrees? I don't know the label text ahead of time, they need to be created as the programs runs. I've found solutions here involving creation of bitmaps and entering Ctrl+Enter on the UIR (which by the way doesn't rotate text, just causes a linefeed after each character) that are not helpful due to the run-time requirement.
0 Kudos
Message 1 of 4
(3,300 Views)
I'm attaching here a simple project I developed some time ago for testing bitmap rotation facilities I needed for an application of mine. You can use it as a sample of how this operation can be made.

In order to do what you want, you may need to substitute controls' labels with text controls (I'm not aware of a way of obtaining an image of a control's label only). When you load your panel, you can:
- Fill the text controls with the text labels you're defining programmatically
- Retrieve each text image as a bitmap using
GetCtrlDisplayBitmap (panel, control, 0, &bitmapID);
- Rotate the bitmap and pass it to an image control adeguately sized and placed in the UIR
- Discard the text controls (or hide them if you need them afterwards)

An improvem
ent to this simple approach could be to dinamically create one single text control and perform all the procedure using it instead of several text controls.

Hope this helps
Roberto


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 4
(3,300 Views)
Hi Robert - Really what I am trying to do is to rotate axis text on the graph itself. (I have a series of time labels that are too long for the display when printed horizontally, and would look just fine if printed on a 90 degree angle) If there really is no simple way to do this, then I think this is a glaring missing feature in LabWindows. That said, I thank you for your very helpful answer, which I think would probably work, but is a bit more onerous of a solution that I was hoping for.
0 Kudos
Message 3 of 4
(3,300 Views)
Just a couple of suggestions on this:

1.- Take a look at this document:
How Can I Customize the X-Axis Labels On My CVI Graph So That They Show Vertical Text Labels? Uses the vertical label in another graph to get the efect.

2.- You can use \n between characters to stack them vertically, the character is not rotated, but the label is vertical.

Hope this helps,

Juan Carlos
N.I.
0 Kudos
Message 4 of 4
(3,300 Views)