LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Add graph title

Solved!
Go to solution

Can a master title be added to a waveform graph and xy graph programmatically?  One which can be centered to the graph itself and which will export via the simplified image?

 

I've looked at using the caption, but cannot find a way to set its location programmatically.  I've also mulled using an annotation, but those are relative to plot X and Y locations.

 

thanks, 

 

XL600

0 Kudos
Message 1 of 8
(4,967 Views)
Solution
Accepted by topic author xl600

Hi,

something like this seems to do the trick:

 

caption.JPG

0 Kudos
Message 2 of 8
(4,926 Views)

Graph Label.png

How's this as a starting point?  You need to "craft" the Graph manually, but then I think you'll be able to manipulate the text programmatically.  Actually, you may even be able to create it programmatically (I haven't tried to do this yet, but all the pieces seem to be in place to allow this).

 

Here's what I did:

  1. Drop down a Waveform Graph (I didn't try with an XY Graph, but it should be the same thing).
  2. Create a Visible Caption, My Graph Label.
  3. "Grab" the Caption and drag it to the middle of the Graph (or wherever you want it).  It will probably be "invisible", black letters against a black background!
  4. Use the Text Settings box (in the Menu Bar, says "15 pt Application Font", and change the Color to White (or Yellow, or Red).  You can also adjust the Font size and make it Bold or Italic (you probably need to select the Caption Text).

If you open a Property Node for the Graph and look at the Caption Property, it has a lot of things you can set, including Text, Text Color, etc.  You can even set its location -- you'll need to "experiment" to see if this is relative to the Graph or relative to the Screen, but since you also have the Graph location/size, you should be able to position it as you wish.  Note that I strongly urge you to bury the "ugly details" of such positioning code in a sub-VI, as it is likely to be messy and would detract from understanding the code involved in actually plotting your data ...

 

Bob Schor

0 Kudos
Message 3 of 8
(4,921 Views)

@xl600 wrote:

 I've also mulled using an annotation, but those are relative to plot X and Y locations.

 

thanks, 

 

XL600


I wouldn't give up on that just yet  Free annotations (annotation Mode 0) are relative to the scale not the plot so....

Capture1.PNGSeems to work.  Some of those annotation properties really need to be played with to see how they interact (read that as once you actually play with them while decoding the help file for "Annotation List Property" hit this button:

Capture1.PNG

And share what you learned with the rest of us

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 8
(4,909 Views)

Well, I tried the caption approach and it kinda works.  It's behavior with respect to autosizing the graph with the window is a little weird.  The autosize doesn't appear to take into account the font size if it's changed programmatically (Probably has something to do with the vertical justification of the caption text).  Also, if I change the font size of a multi-line caption programmatically, only the last line of the caption changes size (Really weird... Notice the "Waveform" text winds up different from the "Graph" text below).

 

Untitled.png

 

Results in:

Untitled.png

 

I should probably look into how to do my own autoscaling (Different topic).

 

It's be nice to be able to snap free labels to a graph/chart at arbitrary locations such that they would be embedded in graph image exports.

 

Thanks,

 

XL600 

 

0 Kudos
Message 5 of 8
(4,898 Views)

cap.png

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 6 of 8
(4,891 Views)

Properties that affect font, might only affect part of the text, depending on the selection settings.

cap.png

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 7 of 8
(4,890 Views)

Yep, that solved the size weirdness...

 

Untitled.png

 

BTW: What I'm doing is providing a small,med, large button for a series of asynchronous pop-up graphs.  For each graph size, I want to adjust fonts and whatever to make it look good when exported as simplified images.  When the user changes sizes, all registered graph panels change size at the same time.  I might add auto-tiling or cascading but each step in turn.... I'm happy at the moment that the graph data feeds to each pop-up independently and reliably via queues that the pop-ups create and pass back to the graph controller.  This allows me to target additional plots to specific graphs as the user requests.  The graphs are controlled via refs and command/status notifiers (Used like an ALL-GRAPH message passing mechanism).


Thanks!

 

XL600

0 Kudos
Message 8 of 8
(4,879 Views)