This page shows how to get started with Wijmo's Gauge controls.
The gauge controls offer a showText property that determines which values should 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 Wijmo gauges have a ranges property that contains an array 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. All angles are measured clockwise, starting at 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 the 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 Wijmo controls to achieve a consistent, attractive look.
You can customize the appearance of the gauges using CSS. To do this, copy the CSS rules from the default theme to a new CSS file and modify the properties as needed.
In this example, we added the "custom-gauge" CSS class to the LinearGauge and RadialGauge controls, and added a CSS rule 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.
By default, Wijmo's radial gauges use a colored sector and a text element to indicate the gauge's current value. This results in a clean and easy-to read look.
If you prefer a more traditional needle-style pointer, you can add an extra SVG shape to the control and apply a transform to move the needle.