LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving graph from subvi

To Whom It May Concern:

 

I am trying to capture the data from a graph using a sub VI. When the sub VI is open, it works fine. On the other hand, when the sub VI is closed I can not capture/save the graph picture to the folder that I have specified.

 

Can someone please give me some advice?

 

Appreciate it a lot. I have attached the sub VI and the main VI graph I am trying to capture.

 

 

Also I am using LabVIEW 8.0. Please consider this when helping me.

 

Download All
0 Kudos
Message 1 of 5
(2,402 Views)

The Export Graph will only work if the graph is actually drawn. On a subVI if the front panel is not visible then there is no visual graph to draw (though the data will still be available), hence the Export Graph will not work.

 

Alternatives:

  • You could have the graph on your main panel, but shoved off to the side so it's not visible. This way it will get drawn. Obviously, you would need the code to export it in your main VI.
  • You can feed a reference of the main graph to the subVI, as shown in the attached mod.

 

Other comments:

  • Not sure what the point of the sequence structure is in your subVI. It does nothing.
  • Do not have hard-coded paths in your code. What if you need to save it in a different directory?
  • Do not use string functions to create paths. Use the Build Path function.
Download All
0 Kudos
Message 2 of 5
(2,389 Views)

Hmmm, using a graph as a control - it took me a little while to wrap my brain around that one. I think your problem might lie somewhere with that server reference - couldn't you just create a plain old INode from the graph? (see attachment)

 

Are MainGraph and CaptureGraph going to be doing more than what's in them right now? Their functionality seems simple enough to put in the same VI.

 

Andrew

Andrew
0 Kudos
Message 3 of 5
(2,382 Views)

Sir Knight of NI, 

 

Thanks!!! I was not aware that the graph had to be drawn to be saved. I was trying to clean up code, so I wanted to do the saving of the graph using sub VI. Main code has a ton more going on than what I sent you. Rest of the code was  not pertaining to capturing the graph.

 

 

 

Other comments:

  • Also I was trying couple of different method to grab the graph image so I added the sequence. 
  • Sub VI code was used for debugging purposes. The path was not that important. But you right, it better coding practice to make path same as the main path user choose.
  • why use build path instead of string? 
0 Kudos
Message 4 of 5
(2,370 Views)

Andrew, 

 

No,  it will not be doing much more than what I have it doing now. 

 

Can you save your example to version 8. I can not view it now because you are using newer version than me..

 

 

Thanks, 

sticyfinger

0 Kudos
Message 5 of 5
(2,367 Views)