This page shows how to get started with Wijmo's Gauge controls.
Steps for getting started with the Gauge controls in KnockoutJS applications:
The gauge controls offer a showText property that determines which values to display as text with the gauge. There are four valid values for the showText property:
The example below shows what happens when you change the showText property.
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, you can use the showRanges property to to hide the ranges. Instead, the gauge determines which range contains the current value and applies 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, BulletGraph, and RadialGauge.
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 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 & 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.