From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Exporting graphs to image file with annotations

Greetings,

 

I'm working on a program that takes a couple of plots on a graph, adds some measurement information on the graph proper, then exports the graph to an image file.

 

I was going to use annotations (with the cursors and arrows turned off) to write the relevant data onto the graph.  The advantage over transparent string indicators being that I can use the Get Image method of WFGraph to grab the image data.  Another big advantage is that I can defer panel updates and resize the plot area so that it's real big so that I get good resolution in the resulting image file as well as changing the BG color to white and the plot and annotation colors to black for printing to a laser printer.

 

However, that's where the annotations come back and bite me.  You can't change the font size and when you blow up the graph size the annotations get tiny.

 

 One thought after poking through the various palettes for inspiration is to use the Picture Plots VI's.  But before I dive headlong into learning a new set of VI's, I'd like to ask if anyone here has used those to good effect?

 

Of course, any other suggestions would be welcome.


Mike

0 Kudos
Message 1 of 4
(3,830 Views)

Take a look at the Invoke Node "Export Image".

This method allows it to chage the file type to EPS.

*.eps files are vector images. That means that the images are scaleable without any loss in quality.

All colors automatically switch to a nicely printable black&white theme.

Just the color of the Graph itself stays the same.

It also shows the annotations. And what you care the most about...

The proportions between annotations and your Graph stay the same at all sizes.

Today most office data processing software supports this file type.

Even if this file type seems a bit messed up in some image preview programs.

Print an eps file and see the difference! 😉

0 Kudos
Message 2 of 4
(3,809 Views)

Thanks for noting that option for me.  I hadn't thought of using EPS as I haven't used postscript anything in ages.

 

I did investigate the picture functions after writing that post and I wound up with a solution far more complicated than I originally planned, but it works. I wrote a subVI that takes a graph reference and a target size, freezes front-panel updates, reads all the annotations from the graph array, clears them from the graph, resizes the graph to the target size and exports it as a "picture", then based on the target size, scales the text and position of "Draw Text in Rect" to add the text onto the picture which is then exported to file after which the graph is set back to whatever settings it had prior to entering the subVI.

 

Whew...

 

Anyway, it works fairly well except when the vertical target dimension gets under 800 or so pixels.  But I'm planning on using it at a fixed, say, 2048x1600 or something so the resulting exported file looks good when printed to a 600dpi printer.

0 Kudos
Message 3 of 4
(3,787 Views)

BTW: There is a way to change chart annotation font style and size.

 

1. Make chart cursor palette visible.

2. Select entire cursor palette.

3. Change font style and size of cursor palette.

 

All chart annotations will take-on cursor palette new font style and size.

 

Anthony Lukindo

 

0 Kudos
Message 4 of 4
(2,773 Views)