Prints the trend line of one or more trend tags. Each trend line is drawn with a different pen style and marker as appropriate. The trend plot includes a comment and a legend, and you can specify the vertical high and low scales. The Mode defines the color mode of the printer. The default mode is black and white.
Note: The TrnPlot() function is used only for sending trends to a printer, and cannot be used for embedding a trend plot in a report.
For more advanced trend plotting, you can use the low-level plot functions.
Syntax
TrnPlot(sPort, nSamples, iTime, rPeriod, sTitle, AN, Tag1......Tag8, iMode, sComment, rLoScale1, rHiScale1, ......rLoScale8, rHiScale8)
sPort:
The name of the printer port to which the plot will be printed. This name needs to be enclosed within quotation marks. For example LPT1:, to print to the local printer, or \\Pserver\canon1 using UNC to print to a network printer.
nSamples:
The number of data points on the plot.
iTime:
For periodic trend or event trends displayed as periodic:
The end point in time (the latest point) for the trend plot.
For event trend type:
The event sample number (e.g. using TrnGetEvent)
rPeriod:
The period (in seconds) of the trend plot. This can differ from the actual trend period.
If you omit the period, it defaults to the sample period of Tag1.
sTitle:
The title of the trend plot.
Tag1. . .Tag8:
The trend tags.
AN:
The AN of the chosen trend. If you enter 0 (zero), the display mode will default to 258. (This is the display mode that is passed into TrnGetTable() when it is called internally by TrnPlot().) If you call TrnPlot() from a report, you need to enter 0 (zero) here.
iMode:
The color mode of the printer.
0 - Black and White
1 - Color
sComment:
The comment that is to display beneath the title of the trend plot. You may pass an empty string if no comment is required.
rLoScale1, HiScale1,......LoScale8, HiScale8:
The minimum and maximum on the vertical scale for the trend line of each of the tags (Tag1. . . Tag8).
Return Value
0 (zero) if successful, otherwise an error code is returned.
Related Functions
TrnComparePlot, TrnPrint, PlotOpen, SPCPlot
Example
/* Prints a black and white plot to LPT1, containing the trend lines of two variable tags (PV1 & PV2). The trend lines have a starting time of 9am, on 11/10/96, 200 sample points, and a period of 2 seconds. The trend line of PV1 will be on a vertical scale of 0-200, and PV2 will be on a vertical scale of 0-400. */
INT time;
Time = StrToDate("11/10/96") + StrToTime("09:00:00");
TrnPlot("LPT1:",200,Time,2,"Citect Trend Plot","PV1","PV2","","","","","","",0,"Process variable operation at shutdown",0,200,0,400);
See Also
Published June 2018