DMC Engineering Posted November 11, 2011 Report Share Posted November 11, 2011 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! Quote Link to comment
hooovahh Posted November 11, 2011 Report Share Posted November 11, 2011 I appreciate the tips but why not post some code showing how to perform these operations? EDIT: Okay I do see the blog post has screenshots of LabVIEW code but no VIs posted. Quote Link to comment
asbo Posted November 11, 2011 Report Share Posted November 11, 2011 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. Quote Link to comment
mje Posted November 13, 2011 Report Share Posted November 13, 2011 Yes, deferring works. We have an implementation that does this, defer, then iterate over each dataset, saving an image for each one, then finally restoring the panel. Works surprisingly well and fast. Quote Link to comment
Mads Posted November 14, 2011 Report Share Posted November 14, 2011 (edited) 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 November 14, 2011 by Mads Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.