Move the Needle Marker Automatically
This topic explains how you can configure the needle on your Radial gauge to move automatically. For example, if you created a Radial gauge to represent a clock, you could configure the hands of the clock to move automatically, giving the impression of a real-time clock.
To move the needle marker automatically on your gauge:
-
From the components tab, drag the Timer component to your form.
-
In the Properties window, set the Enabled properties to True.
-
In the component tray, double click the Timer component.
-
The following example code accesses the needle marker on your Radial gauge and increases the value by 5. Place the code in the timer1_Tick method:
Dim myRadialGauge As RadialGauge = Me.ultraGauge1.Gauges(0)' Access Needle marker
Dim myMarker As RadialGaugeMarker = myRadialGauge.Scales(0).Markers(0)
Dim currentValue As Integer = CInt(myMarker.Value)
' Increases needle by 5
myMarker.Value = currentValue + 5
RadialGauge myRadialGauge = this.ultraGauge1.Gauges[0] as RadialGauge;
// Access Needle marker
RadialGaugeMarker myMarker = myRadialGauge.Scales[0].Markers[0];
int currentValue = (int)myMarker.Value;
// Increase needle by 5
myMarker.Value = currentValue + 5;
-
In the Properties window, click the Gauges property. Then, click the ellipsis (…) button to open the Gauges collection editor.
-
Locate the Scales property and click the ellipsis (…) button to open the Scales collection editor.
-
Locate the Markers property and click the ellipsis (…) button to open the Markers collection editor.
-
Expand the Response property.
-
Set the Enabled property to True. The RefreshRate property is the amount of time between each update of the gauge. Set the RefreshRate property to 00:00:00.1000000. The ResponseRate property is the amount of time taken for the marker to traverse the entire scale of the gauge. Set the ResponseTime property to 00:00:01. Setting the Response property gives your bar a smoother appearance as it increases along the scale;your bar marker doesn’t appear as if it is jumping from value to value.
-
Save and run the application.