8.5.52 RectElement

The RectElement draws a rectangle with a selectable color. The element may listen to a parameter value and change the color of the rectangle according to the parameter value.

Data Model (extends ScreenElement)

Key Type Value
type String Always "RectElement".
xpos Number see ScreenElement
ypos Number see ScreenElement
width Number see ScreenElement
height Number see ScreenElement
id String The message ID this element listens to. Is only relevant if variableLineColor reads true.
fill Boolean true = draw the rectangle filled, not only the outline.
color String The color used for the rectangle.
variableLineColor Boolean true = set the line/fill color from the value received from the parameter addressed by id.
useColorTranslation Boolean use the colors[] translation
colors Array of ColorDefinition objects. Defines how to translate values of the id parameter to color values if useColorTranslation reads true.

Variable Line Color

With variableLineColor=true the RectElement will change its line/fill color depending on the value of the parameter addressed by id. This way the rectangle can be used as a status indicator. The way the RectElement interprets the parameter value depends on the value of useColorTranslation.

If useColorTranslation=false, the RectElement tries to decode the line color directly from the parameter value. First it does the following tests on the parameter value (not case sensitive):

Parameter Value Line Color And Thickness
ends with BOLD The line is drawn thicker than normal
starts with BLACK The line is drawn with this color
starts with WHITE The line is drawn with this color
starts with RED The line is drawn with this color
starts with BLUE The line is drawn with this color
starts with GREEN The line is drawn with this color
starts with YELLOW The line is drawn with this color
starts with GRAY The line is drawn with this color
contains TRUE If the message ID identifies the parameter as an alarm flag (the ID contains 'fault'), the line is drawn RED-BOLD, for other parameters it is drawn GREEN-BOLD
contains FAULT The line is drawn RED-BOLD
starts with ON The line is drawn GREEN-BOLD

If none of the above conditions apply, the RectElement tries to interpret the parameter value as a hex coded color (#RRGGBB). If this also fails, the standard line/fill color defined in color is used.

If useColorTranslation=true, the RectElement uses the ColorDefinition table in colors[] to decode the line's color and thickness.