This control allows you to display information in the form of ranges, and decide whether you want to show it using linear or circular gauges.
When you enter a variable of string type and change the value of the Control Type property to SD Linear Gauge, GeneXus automatically generates a new SDT called GaugeSDT, which is divided by properties and values that will affect the control as a whole; the same applies to each range.
||Text shown above the control if it is of Linear type; if it is of Circular type, it will be shown in the center of the control.
||Allows you to choose the form in which it will be displayed. The possible values are Line, Circular. The default value is Line.
||Applicable when the control is of Circular type; it allows specifying the width of the circumference.
||Height of the range bars.
||Indicates the maximum value the control can represent, i.e., the sum of all its ranges.
||Indicates the minimum value that a range can represent.
||Indicates the current value represented.
||Allows displaying the maximum and minimum value indicators.
||Allows displaying the value.
||A hexadecimal string value. Example: "#F80303"
||Name of this range.
||Length of this range.
Now you will place a variable of string type in your Panel for Smart Devices and will change the Control Type property to SD Linear Gauge (variable called &LineGauge in this example).
Note that changing the GeneXus control type will change the preview of the object. The image shown in the layout is merely illustrative.
In the Refresh event, you will load the data. In this case, it will be provided by a Data Provider (called LoadData in the example). It will have the following structure:
MaxValue = 100
MinValue = 0
Value = 35
Height = 8
ShowMinMax = False
ShowValue = True
Color = '#00FF00'//Green
Name = 'Low'
Length = 28
Color = '#FF8000'//Orange
Name = 'Medium'
Length = 52
Color = '#FF0000' //Red
Name = 'High'
Length = 20
Following the same line and reusing the returned data you will change 2 properties of the control (Thickness and Type) to display the same information but using the circular type (variable &CircularGauge). The code is as shown below:
&GaugeSDT = LoadData()
&LineGauge = &GaugeSDT.ToJson()
&GaugeSDT.Type = 'Circular'
&GaugeSDT.Thickness = 35
&CircularGauge = &GaugeSDT.ToJson()
The properties Animated and Animated Duration of the Attribute class applies to this control, generating an animation that will be displayed when loading the view where it is located.