Modify the pen style of a point during run time

Use Style Modifier to modify the pen style of a point in a trend control.

By default, the data points in a trend control are drawn with a solid, black line. You can change the style of the line — more specifically, you can change the style of the pen that draws the line — by changing the settings in the Pen Style dialog box. The user can also open the Pen Style dialog box during run time and change the settings then. For more information, see Pen Style dialog box

Alternatively, you can use Style Modifier (in the Options dialog box) to programmatically modify some of the pen style settings during run time. In other words, you can specify project tags that will determine the pen style settings, and then you can use scripts or user input to change the tag values during run time.
Figure 1. Options dialog box
Web Studio Help dialog objectproperties trendcontrol points options Modify the pen style of a point during run time

The Style Modifier box accepts a text string that includes one or more parameters, and each parameter modifies one element of the pen style. The text string must have this basic format:
  <Parameter1>=<Value1>;<Parameter2>=<Value2>;…;<ParameterN>=<ValueN>  
The following table lists the supported parameters and their accepted values:
Parameter Description Accepted Values
Expansion The method or algorithm used to connect the data points.
  • 0 (smooth/analog)
  • 1 (squared/digital)
Type The type of line (e.g., solid, dashed, dotted) that connects the data points.
  • 0 (solid)
  • 1 (dashed)
  • 2 (dotted)
  • 3 (dash-dot)
  • 4 (dash-dot-dot)
Weight The weight (i.e., thickness) of the line, in pixels. from 0 to 10
Color The color of the line.

For more information about colors in IWS, see Color Interface.

a 24-bit color value from 0 to 16777215
Note: These parameters are the same as the settings in the Pen Style dialog box.

You could specify literal values for any or all of the parameters, but that is effectively the same as using the Pen Style dialog box to configure those settings. The key to programmatically modifying the pen style is specifying tag names or expressions enclosed in curly brackets ({}) for the parameter values. Then, whenever the value of a specified tag/expression changes, the pen style is modified.

For example, in the Style Modifier box, type the following string:
  Expansion={ExpansionTag};Color={RGBColor(0,0,ColorTag)}  

For the parameter Expansion, you specified the project tag ExpansionTag enclosed in curly brackets. There are only two accepted values (0 and 1) for Expansion, so ExpansionTag could be Boolean type. Then, whenever the value of ExpansionTag changes during run time, the expansion method is modified accordingly.

For the parameter Color, you specified an expression that calls the function RGBColor to convert RGB color values to a 24-bit color value. The red and green color values remain constant at 0, but the blue color value is determined by the project tag ColorTag. Then, whenever the value of ColorTag changes during run time, the value returned by the function also changes and the line color is modified accordingly.

Following this example, you can specify any project tags or expressions for the parameters as long as their returned values are within the accepted values for the parameters.

Modify the pen style of a point during run time