ptZoomCurrentPen() function
- Last UpdatedJun 17, 2024
- 1 minute read
The ptZoomCurrentPen() function can be used in a script to change the value range shown on a trend’s Y-axis. The range of the trend’s vertical value axis can be increased or decreased by a specified zoom ratio.
Category
Pen trend
Syntax
ptZoomCurrentPen(TrendName,ZoomFactor);
Arguments
TrendName
The name of the trend object. Must be either a string constant or message tag.
ZoomFactor
Assigning a number larger than 1.0 increases the value range of the trend by multiplying the current range limits by the zoom factor. Assigning a zoom factor less than 1.0 decreases the value range shown in the vertical axis of the trend.
Remarks
The zoom ratio is applied to the existing span of the current pen’s Y-axis range. For example, if the trend starts with a Y-axis range of –50 to 50 and then you zoom by a ratio of 2.0, the new range is –100 to 100. If you zoom by 2.0 again, then the new range is –200 to 200. The zoom ratio applies to the range currently in effect, not the original Y-axis range.
The zoom ratio persists during run time for each of the trend’s pens. As you switch from one pen to another using the ptSetCurrentPen() function, the Y-axis value range reflects the current scaling for the selected pen.
Example
The ptZoomCurrentPen function doubles the Y-axis range of the current tag in the trend named "PumpPress".
ptZoomCurrentPen("PumpPress",2);