Jump to content

Programmatic Saves of LabVIEW Plots and Charts


Recommended Posts

Let’s face it, us engineers and scientists like graphs. It’s very common for a user to desire an image capture of data displayed in their program to share with their friends and colleagues. There’s quite a few nice features native to LabVIEW that makes this process easy and convenient. Here is a description of three good options: Manual Save, Programmatic Save, and Save Entire Tab. To access the photos of these graphs, you can find them in my blog: http://www.dmcinfo.com/Blog/articleType/ArticleView/articleId/969/Programmatic-Saves-of-LabVIEW-Plots-and-Charts.aspx

Manual Save

You can manually right-click any graph or plot during runtime and select Export > Export Simplified Image. Choose a name for your *.bmp image and directory and save an exact image of the graph to disk. Notice that LabVIEW automatically changes the default black graph background to white, but doesn’t alter any of your active plot trace colors. Also note that a graph save captures only what is seen by the user during that instant.

Programmatic Graph Save

This save feature is also available programmatically through LabVIEW methods. When not running, right-click on the graph you’d like to save during runtime and create a reference. Find and select the graph method “Export Image”. Wire the ‘Image Data’ output from the node into one of the image write VIs found in the ‘Graphics and Sound’ > ‘Graphics Formats’ palette. Make sure to append the correct file extension to your path. While you’re here, you should automatically change the background and plot trace colors to more desirable selections. This will cause the graph to flash briefly during the save but will create a much nicer image.

Save Entire Tab

Often the graph doesn’t contain all necessary information such as user parameters governing the process. If these setting are available near the graph on a tab control, you can take a screenshot of the open tab and save it to disk. The method is very similar to the single graph save, but simpler since the graph colors don’t need to be altered.

Hopefully you will find these methods useful and easy to implement!

Link to comment

Programmatic Graph Save

This save feature is also available programmatically through LabVIEW methods. When not running, right-click on the graph you’d like to save during runtime and create a reference. Find and select the graph method “Export Image”. Wire the ‘Image Data’ output from the node into one of the image write VIs found in the ‘Graphics and Sound’ > ‘Graphics Formats’ palette. Make sure to append the correct file extension to your path. While you’re here, you should automatically change the background and plot trace colors to more desirable selections. This will cause the graph to flash briefly during the save but will create a much nicer image.

I haven't tried it, but I bet you could use Defer Panel Updates to mitigate or remove this problem altogether.

Link to comment

There is another interesting option here.

The end goal of the user is often not to save the graph as an image, but to get the image into a document. Instead of forcing the user to save the image as a file first, you can add a "Copy As Image" option. The key to get this functionality is to generate the image and load it in a picture control in the background - and then use the picture control's Export Image method with the target set to Clipboard.

The attached VI does the job for you once you have generated the picture.

Image to Clipboard.vi

Edited by Mads
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.