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 = { seriesList: ko.observableArray([createRandomSeriesList('legend' + index)]) }; |
Create View with Bound Controls:
View Markup |
Copy Code |
---|---|
<div id="wijlinechart" data-bind="wijlinechart: {seriesList: seriesList}"></div> |