Move the Bar Marker Automatically
This topic explains how you can configure the bar marker on your Linear gauge to move automatically. For example, if you created a Linear gauge to represent a thermometer, you could configure the mercury level to rise and fall, simulating a real thermometer.
To move the needle marker automatically on your gauge:
-
In the Properties window, set the RefreshInterval property to 10 seconds. This fires an AsyncRefresh event on the server at each of these intervals.
-
The following example code accesses the needle marker on your Linear gauge and increases the value by 5.
Protected Sub UltraGauge1_AsyncRefresh(ByVal sender As Object, _
ByVal e As Infragistics.WebUI.UltraWebGauge.RefreshEventArgs) _
Handles UltraGauge1.AsyncRefresh
Dim gauge As LinearGauge = Me.UltraGauge1.Gauges(0)
Dim marker As LinearGaugeMarker = gauge.Scales(0).Markers(0)
Dim value As Integer = Convert.ToInt32(marker.Value)
marker.Value = value + 5
End Sub
protected void UltraGauge1_AsyncRefresh(object sender,
Infragistics.WebUI.UltraWebGauge.RefreshEventArgs e)
{
LinearGauge gauge = this.UltraGauge1.Gauges[0] as LinearGauge;
LinearGaugeMarker marker = gauge.Scales[0].Markers[0];
int value = Convert.ToInt32(marker.Value);
marker.Value = value+5;
}
-
Save and run the application.