LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Decorations

Solved!
Go to solution

This seems like it should be really easy, but then again I've been at work for the past 13 hours, so maybe I'm just being dumb.

 

I have an XY graph. I wanted to put some decorations over it to indicate a certain area.

I clicked on all the lines, then selected "Move to Front"

I then clicked the graph and clicked "Move to Back".

 

When it's not running it looks correct:

Stopped.PNG\

 

 

As soon as I start running the VI, the decorations drop behind the graph.

 

running.PNG

 

Am I missing something obvious?

Cory K
0 Kudos
Message 1 of 5
(2,809 Views)

If your decorations are completely contained within the graph area, can I suggest an alternate approach?  The XY Graph has a set of "Plot Images" properties.  You can write to them to draw on the graph, using the picture functions.  So, for example, if you just want to draw a rectangle on a portion of the graph, you can do so using "Draw Rect" with the picture output wired to the plot image.

Message 2 of 5
(2,799 Views)

@nathand wrote:

If your decorations are completely contained within the graph area, can I suggest an alternate approach?  The XY Graph has a set of "Plot Images" properties.  You can write to them to draw on the graph, using the picture functions.  So, for example, if you just want to draw a rectangle on a portion of the graph, you can do so using "Draw Rect" with the picture output wired to the plot image.


The Draw Rect function takes inputs of Left, Top, Right, Bottom.

Are those coordinates in the XY graph or coordinates on the entire front panel?

Cory K
0 Kudos
Message 3 of 5
(2,797 Views)
Solution
Accepted by topic author Cory_K

@cory K wrote:

The Draw Rect function takes inputs of Left, Top, Right, Bottom.

Are those coordinates in the XY graph or coordinates on the entire front panel?


They're relative to the graph area (0,0 is the upper left of the graph).

 

As you may know, the graph has a method called "Map XY to Coords" which gives you coordinates relative to the panel origin.  You can convert this to coordinates within the graph for use with the drawing functions by subtracting the "left" and "top" coordinates of the graph's Plot Bounds.  I find it convenient to bundle these two properties into a cluster and then subtract the cluster from the output of Map XY to Coords.  This is useful for drawing images within the graph's coordinate system.

Message 4 of 5
(2,794 Views)

Awesome, thanks. Worked perfectly.

Cory K
0 Kudos
Message 5 of 5
(2,788 Views)