Steps for getting started with the Gauge control in MVC applications:
The gauge controls offer a ShowText property that determines which values should be displayed as text by the gauge. There are four valid values for the ShowText property:
The example below allows you to see what happens when the ShowText property is changed.
All ASP.NET MVC gauges have a Ranges property that contains an list of Range objects. By default, the ranges are displayed on the face of gauge to indicate zones of interest; however, the ShowRanges property can be used to to hide the ranges. Instead, the gauge will determine which range contains the current gauge value and will apply that range's color to the gauge pointer.
The Range object itself offers properties such as Min, Max, and Color to customize each zone.
The following example demonstrates how to use ranges with the LinearGauge, RadialGauge, and BulletGraph.
The RadialGauge offers two properties to configure its layout, StartAngle and SweepAngle. The StartAngle property specifies the RadialGauge's starting angle, or rotation. The SweepAngle property specifies an angle representing the length of the RadialGauge's arc. The angle for both properties are measured clockwise, starting a the 9 o'clock position.
The RadialGauge also offers the AutoScale property. When AutoScale is set to true, the RadialGauge will be automatically scaled to fill its containing element.
The following example allows you to adjust the StartAngle, SweepAngle, and AutoScale properties in real-time.
The RadialGauge's StartAngle and SweepAngle properties do not apply to the LinearGauge or BulletGraph. Instead, the LinearGauge and BulletGraph offer the Direction property to determine how it should be displayed. There are four options for the Direction property:
The example below allows you to see what happens when the Direction property is changed.
The appearance of the gauge controls is largely defined in CSS. In addition to the default theme, we include several professionally designed themes that customize the appearance of all ASP.NET MVC controls to achieve a consistent, attractive look.
In this example, we added the "custom-gauge" CSS class to the LinearGauge & RadialGauge, and define some CSS rules to create an orange pointer for both.
The gauge controls can be used as a simple indicator or as an input control when the IsReadOnly property is set to false. The gauges also offer a Step property that determines how much to add or subtract from its current value when being used as an input control.
The example below demonstrates how to use the IsReadOnly and Step properties with the LinearGauge and RadialGauge controls.