Blog

Programmatic Saves of LabVIEW Plots and Charts

Let’s face it, 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.

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.

  

Here you can see the image “graph1 – 11Oct27.bmp” as produced by the above code.  Notice the angle cluster and graph title is also captured, giving more context to the displayed data.

Hopefully you will find these methods useful and easy to implement.  Feel free to add any additional features or solutions that you utilize in the comments below.

Learn more about DMC's LabVIEW expertise.

Comments

Thuy
# Thuy
Nice. Could you please give me the advice? I would like to get the value of an array in Labview using Javascript, then with those values, I want to draw a graph and show it in a .html. However, I do not know how to get the value of an array in Labview using Javascript. Please help me. Thank you so much.
Sergio
# Sergio
Another option, which I found out was to make a subvi, which is a printing template for the graph and plots. It gets the data, setups plots colors, saves the bitmpa in any form you like. You just call this sub-vi from your main code and you're done.

Post a comment

Name (required)

Email (required)

CAPTCHA image
Enter the code shown above: