Use TrendSpec to Define an Ad Hoc Trend’s Text Attributes

This example demonstrates how the Optional Values that define the text attributes in an ad hoc Trend might be used to customize that Trend.

Example:

The fonts used in an ad hoc Trend are to differ from the ViewX defaults.

TrendSpec is used to define the font properties.

The Trend is accessed via a button on a Mimic. The button is configured to display the Trend using the Geo SCADA Expert script hyperlink function Mimic.Navigate. This function means that when the button is selected, the ad hoc Trend is shown in the current window, replacing the Mimic from which the Trend was selected.

The script for the hyperlink comprises a subroutine that specifies the location of the Trend file, along with its TrendSpec definition:

sub MyAdHocTrend

dim S

S = "SCX:////Trend/"

S = S & "TREND("

S = S & "TRACE(PROCESSEDHISTORIC, 'Y Axis 1',"

S = S & "LabelExpr = '""AdHocTrends.Sensor1.FullName""',"

S = S & "ShowAnnotations = True,"

S = S & "SOURCE('AdHocTrends.Sensor1.Historic')),"

S = S & "XAXIS(RELATIVENOW),"

S = S & "YAXIS('Y Axis 1' , Label = 'Point Value',"

S = S & "LabelPos = CENTRE, LabelStyle = ROTATED),"

S = S & "TitleExpr = '""AdHocTrends.Sensor1.Name""',"

S = S & "ShowTitle = True, ShowKey = True,"

S = S & "AlarmLimitLabelPos = LIMITLABELOVERRIGHT,"

S = S & "TitleFont = 'Arial', TitleFontHeight = 10,"

S = S & "TitleFontStyle = FONTSTYLEBOLD, MainFont = 'Tahoma',"

S = S & "MainFontHeight = 8, MainFontStyle = FONTSTYLEBOLDITALIC,"

S = S & "LabelFont = 'Tahoma', LabelFontHeight = 8, LabelFontStyle = 0)"

Mimic.Navigate( S )

End Sub

The various FontStyle identifiers can be assigned either integer or identifier values (see Supported FontStyle Identifier and Integer Values). As such, LabelFontStyle, for example, could be assigned either 0 or FontStyleRegular, in order for the label text to use a regular weight font.

The TrendSpec definition sets the text so that when the Trend is displayed, the text is assigned these properties:

Trend showing the the effects of various TrendSpec settings

The properties of the font used in the key and the annotation pop-up are inherited from the Windows® system palette.

Further Information

For detailed information on scripting, see the Geo SCADA Expert Guide to Scripting.

For information on using a hyperlink to display an ad hoc Trend, see Creating a Hyperlink to a Trend or X-Y Plot.


Disclaimer

Geo SCADA Expert 2022