LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why can't I programmatically align a picture to a graph?

Labview 7.0; Mac or PC
OK, so it sounds like a simple problem, right:
- bottom line: I want a graphical plane (picture with transparent background) overlaid on an intensity vs XY data set (Intensity graph). And I want the two image planes to overlay properly, so I want to do the alignment programmatically (draw/plot areas of picture and intensity graphs to be the same size and in the same location).
Here is the problem that I run into:
- summary: Some of the (important) property node positional and size attributes of the intensity graph return strange values that therefore can not be used as input to positional properties of the picture.

OK, more specifically, what I tried and saw:
- create a picure, of any size, on a front panel. Make the background transparent, and make the label not-visible
- create an intensity graph, of any size, on a front panel. Make the label not-visible.
- make a property node for the intensity graph and another one for the picture
- set the draw area of the picture = plot area of the intensity graph. OK, that was easy, and works fine (you can manually align the two to see that this works, but then mis-align the two to continue)
- note that there is no property to identify the origin of the plot area of the intensity graph directly.
- Hmmmm, maybe the scale marker bounds on the graph can be used to (somewhat closely,but maybe not exactly) identify the origin of plot area of the graph...
- set the position>left property of the picture = X scale>marker>position>left
- set the position>top property of the picture = Y scale>marker>position>top
- IT WON"T BE ANYWHERE even close (the alignment is way off)
It gets better:
- on the front panel, move the graph up maybe 50 pixels, and to the right about 50 pixels
- run the vi again and see that the picture moves to the right as expected, but has not moved up at all
There's more, but I don't want to complicate the picture any more. I'll just summarize by saying that it appears that some of the intensity graph-components position/size properties change in value based on the number or types of properties requested.

I haven't tried aligning the graph to the picture instead, but I'm guessing that I'm missing something stupidly simple in this example, and someone can help to restore my sanity.

Thanks, in advance
0 Kudos
Message 1 of 5
(3,366 Views)
Could you attach your VI so we get a better impression of exactly what you are trying to do and how you are doing it?
 
A few things come to mind, for example make sure to disable "auto adjust scales", else the plot are will change whenever the scales need more or less room.
 
You might consider using an image indicator and built the entire display, including the intensity graph data as a plain image. Shouldn't be too difficult.
 
Of course the easiest solution would be to upgrade to LabVIEW 8.0. One of the great new features is the capabilitiy to draw images directly on the graph area (See example named "Plot Images", LabVIEW 8.0 only).
 
0 Kudos
Message 2 of 5
(3,362 Views)
altenbach,
Thanks for the reply. Sorry, I didn't realize how easy it is to attach a vi. OK, attached is the simple vi. I made the vi even simpler... it matches my text more exactly. Interestingly, the result is a little different: now, if you move the graph and rerun the picture moves accordingly... but still, the picture is not positioned as I'd expect.

Also, thanks for note about scale changes (and associated plot area size changes)... I had thought of that, but hadn't figured out yet if it was going to be an issue for my application; and if so, how I'd deal with it.

I'm not quite ready to upgrade all the existing code to Labview 8 - much of the code is fielded to customers so there is a business aspect to work out. But, I'm looking forward to starting to experiment with Labview 8.

I'm not sure I appreciated your "image indicator" idea. Maybe you mean use either a picture for both graph and picture; or use graph for both graph and picture. This is not a bad idea based on other aspects of the application that I ran into. I wanted a picture to make use of the draw tools. But, I need to draw ovals and rectangles; rotate and pan them individually and as a group. I found that I had to build the oval and rectangle shapes (out of line segments) my self in order to get the rotation function. So, if I'm just using line segments (that I define) to build arbitrarily rotated ovals and rectangles, I could use an XY graph and get zoom and pan for free (so to speak).

Thanks
0 Kudos
Message 3 of 5
(3,361 Views)

Search all of this thread for some picture indicator uses. You can rotate a picture image.

http://forums.ni.com/ni/board/message?board.id=BreakPoint&message.id=14

Message 4 of 5
(3,346 Views)
Try the Xscale.left and Yscale.top properties, seems to work quite well with a small tweak. See atttached (LabVIEW 7.0)
 
(In LabVIEW 8.0, we also have a plot.bounds property which does the job ;))
0 Kudos
Message 5 of 5
(3,343 Views)