Wijmo User Guide > Concepts > Knockout > Two-Way Live Binding > KO PieChart Binding |
Data-binding options:
Example:
In this example, the ViewModel is defined specifically for use with the line chart. It has a seriesList property that is bound in the View. If this value changes, the widgets automatically respond. The widgets also update the ViewModel values.
Create a ViewModel:
ViewModel Script |
Copy Code
|
---|---|
var viewModel = function () { var self = this; self.males = ko.numericObservable(10); self.females = ko.numericObservable(90); }; |
Create View with Bound Controls:
View Markup |
Copy Code
|
---|---|
<div class="piechart" data-bind="wijpiechart: { width: 600, height: 400, seriesList: [ {label: 'Male', data: males}, {label: 'Female', data: females} ] }"> </div> |