Wijmo UI for the Web
KO LinearGauge Binding
Wijmo User Guide > Concepts > Integrating Frameworks > Knockout > Two-Way Live Binding > KO LinearGauge Binding

Data-binding options:

Example:

In this example, the ViewModel is defined specifically for use with the linear gauge. It has disabled, min, max, and value properties that are bound in the View. If any of these values change, then the widgets will automatically respond to them. The widgets also update the ViewModel values as they modify them. This gauge starts at 0, goes up to 100, and has an initial value of 50.

Create a ViewModel:

ViewModel Script
Copy Code
var viewModel = function () {  
  var self = this;  
    self.min = ko.observable(0);  
    self.max = ko.observable(100);  
    self.val = ko.observable(50);  
};

Create View with Bound Controls:

View Markup
Copy Code
<div data-bind="wijlineargauge: {  
    value: val,  
    min: min,  
    max: max,  
    ranges: [{  
        startWidth: 0.2,  
        endWidth: 0.2,  
        startValue: 0,  
        endValue: val,  
        startDistance: 0.6,  
        endDistance: 0.6,  
        style: { fill: '#ccc', stroke: 'none'}}]  
}"> </div>
See Also

Concepts

Widgets

Reference