Data-binding options:
Example:
In this example, the ViewModel is defined specifically for use with the composite chart. It has the seriesList property bound in the View. If this value changes, then the widgets will automatically respond. The widgets also update the ViewModel values as they modify them.
Create a ViewModel:
ViewModel Script |
Copy Code |
---|---|
var viewModel; <!-- Create ViewModel --> <!-- Bind ViewModel --> $(document).ready(function () { viewModel = { seriesList: ko.observableArray([createRandomSeriesList('legend' + index)]) }; ko.applyBindings(viewModel); }); |
Create View with Bound Controls:
View Markup |
Copy Code |
---|---|
<div id="wijcompositechart" data-bind="wijcompositechart: {seriesList: seriesList}" style="width:600px;height:400px;"> </div> |