Version

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.

This topic assumes that you have a Radial gauge already created. For information on how to create a gauge, see Creating a Radial Gauge in Design View.

To move the needle marker automatically on your gauge:

  1. From the components tab, drag the Timer component to your form.

  2. In the Properties window, set the Enabled properties to True.

  3. In the component tray, double click the Timer component.

  4. 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:

In Visual Basic:

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

In C#:

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;
  1. In the Properties window, click the Gauges property. Then, click the ellipsis (…) button to open the Gauges collection editor.

  2. Locate the Scales property and click the ellipsis (…) button to open the Scales collection editor.

  3. Locate the Markers property and click the ellipsis (…) button to open the Markers collection editor.

  4. Expand the Response property.

  5. 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.

  6. Save and run the application.