07-02-2023 03:45 PM
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).
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.
07-02-2023 05:31 PM
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.
07-02-2023 05:47 PM
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.
07-03-2023 12:50 PM - edited 07-03-2023 01:04 PM
@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?
07-03-2023 01:03 PM - edited 07-03-2023 01:05 PM
@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.
07-04-2023 11:28 AM - edited 07-04-2023 11:29 AM
@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