Data-binding options:
Example:
In this example, the ViewModel is defined specifically for use with the bar chart. It has disabled, stacked and seriesList 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.
Create ViewModel |
Copy Code |
---|---|
var viewModel = { header: ko.observable('head'), stacked: ko.observable(false), seriesList: ko.observableArray([createRandomSeriesList('legend' + index)]) /*[{ label: 'US', legendEntry: true, data: { x: ['PS3', 'XBOX360', 'Wii'], y: [12.35, 21.50, 30.56]} }] */ }; |
Create View with bound controls:
View Markup |
Copy Code |
---|---|
<div id="wijbarchart" data-bind="wijbarchart: { disabled: disabled, stacked: stacked, seriesList: seriesList }"> </div> |