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.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Printing strip chart data

I need some ideas for an implementation.
 
I have an application that does some tests, some taking hours.  One product of each test is a strip chart of pressure data.  The strip chart may have 4 hours of data, taken one sample per second.
 
I need to print the data in the form of x-y plots, similar (essentially identical) to the strip chart, for inclusion in reports.
 
There does not seem to be any obvious way within CVI to do that.
 
Considering the people that will be operating this system, something that is very easy (click a control, and it prints) would be best, as opposed to something like, saving data to a file, open the file in Excel, create a chart, etc, etc....
 
Any thoughts...
0 Kudos
Message 1 of 9
(4,230 Views)

How about a PrintCtrl() call, inside an EVENT_RIGHT_CLICK callback trap for the stripchart control?

JR

0 Kudos
Message 2 of 9
(4,227 Views)
JR,
No, tried that, it prints the control and only what is displayed in the control.  There might be 4 hours of data that needs to be printed.  I'm expecting several or many pages of printout.
 
I can save the data as it is passed to the Strip Chart Control, in a file or an array.  That data can be passed to something to create output for the printer.
0 Kudos
Message 3 of 9
(4,225 Views)
Since you say that you can save the data as you plot it onto the strip chart, couldn't you, when you need to print it, just create a graph control in autoscale mode, in a hidden panel, then plot the full data onto that graph as a single Y plot, and then print the graph using PrintCtrl?

Luis
0 Kudos
Message 4 of 9
(4,220 Views)
Luis,
 
Don't tell anybody who might be out there with a better idea, but I'm prototyping that right now.  Not very elegant, but probably workable.  Actually, rather than do the autoscale thing, I'm going to write blocks of data to the control, print the control, write another block, etc.  We'll see....
 
Thanks...
0 Kudos
Message 5 of 9
(4,206 Views)

How did your prototype work out?  Anything you can share with the forum?  I have an interest in something similar too.

0 Kudos
Message 6 of 9
(3,390 Views)

9 years later...  Yes, it worked very well and is use in an in-house test fixture.  It was done as described:  Save all strip-charted data to an array on the fly.  When the operator clicks the print button, blocks of the array are plotted to a different strip chart control, hidden, with all the proper chart control formatting, and then the control is printed.  That repeats until all data in the array has been printed.  In use, this might produce 10 or 20 pages of strip chart plots.

Message 7 of 9
(3,388 Views)

Thanks.  The bit I'm not clear on is the data collection.  I'm not seeing a strip chart function that pulls data from the strip chart.  So I assume that it's up to me to simply retain all the data that I plot to my strip chart for later possible saving.

 

Now if I'm plotting to mine only a single data point at a time (array size 2), then I need to dynamically grow some master array for plotting to a hidden chart later.  How did you avoid buffer overrun?  Dynamically resizing?

0 Kudos
Message 8 of 9
(3,386 Views)

Yes, you have to save the data points on the fly.  As you process your data into a data point to send to the strip chart, also send it to an array.

 

Since the stuff I create is either delivered or has to stand alone and just work for long periods of time, I avoid a number of things in my programming.  One of those is dynamic memory allocation.  For my hours to days strip charting, I know what the rate is, and create a static array larger than necessary.  RAM is cheap in this day and age -- if you create a 1 mega-double array (8 MBytes) or larger, no big deal.

 

I suppose if you want to do it dynamically, you might malloc the arrays one strip chart screen at a time.  Keep track of them with pointers.  That way there is not much possibility of running out of memory.  Then when somebody clicks print, you access those malloc'd blocks one at a time, send to the hidden control, and print it.

Message 9 of 9
(3,380 Views)