LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to capture a plot image without showing the tab page that contains the plot

Hello,

 

I have a UI with multiple tab pages. There are three waveform charts on one of the tab pages.

 

Is there any way to capture an up-to-date image of the three plots in a single JPG file without displaying the plot page (while another page is displayed).

 

5.png

 

Using the above method, if I don't make sure the plot page is active before taking an image, it doesn't work.

 

Thank you.

0 Kudos
Message 1 of 6
(1,139 Views)

AFAIK, this image capture is an UI feature, that means if there is no UI update, it will not capture the latest. You need to force it to draw to get the latest image. 

 

A better approach would be to maintain the data in an array in your state machine or backend code, whenever you need to generate the graph image, use one of the community plotting library to generate the image.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 2 of 6
(1,108 Views)

Hi,

 

It should work as expected even if the graphs are not in the currently visible tab.

Try the attached VI.

 

If this does not work in your application, it means you have something specific that you need to explain in more details.

 

Also, what do you mean by "it doesn't work" ?

 - Is the JPEG file not created ?

 - Do you get an error ?

 - Is the image not up-to-date compared to the data being written to the graph ?

 

Regards,

Raphaël.

Message 3 of 6
(1,097 Views)

@santo_13 wrote:

A better approach would be to maintain the data in an array in your state machine or backend code, whenever you need to generate the graph image, use one of the community plotting library to generate the image.


If all else fails, that would be the way. It would be a bit involved to create images comparable to screencaps that capture everything on the plots. Do you happen to know any good library for this?

0 Kudos
Message 4 of 6
(1,037 Views)

@raphschru wrote:

Also, what do you mean by "it doesn't work" ?

 - Is the JPEG file not created ?

 - Do you get an error ?

 - Is the image not up-to-date compared to the data being written to the graph ?


By "it doesn't work", I mean the image is not up-to-date. It keeps giving me the last seen plots until I display the page.

 

The VI you shared works fine. I directly copied the waveform charts taking waveform data (t0, interval, data) which I use in the actual project to your VI and it worked, too. To make it more similar to my project, I created another VI with tab pages. One of the pages has a subpanel that calls your VI. It still works with such nested tab controls. I didn't have to show the plot page to get up-to-date images. In the actual project, the main Actor Core has tab pages with subpanels that call other Actor Cores. I am still trying to figure out what is causing this difference.

0 Kudos
Message 5 of 6
(1,033 Views)

@Arcanix wrote:

@santo_13 wrote:

A better approach would be to maintain the data in an array in your state machine or backend code, whenever you need to generate the graph image, use one of the community plotting library to generate the image.


If all else fails, that would be the way. It would be a bit involved to create images comparable to screencaps that capture everything on the plots. Do you happen to know any good library for this?


This looks promising - https://advancedplotting.github.io/

And this library has its own forum group - https://forums.ni.com/t5/Advanced-Plotting-Toolkit/bd-p/5004

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 6 of 6
(994 Views)