I want dynamically update the values(or add extra legend item) on my chart thus I can't use the 'hardcoded' html markup from the flexchart example page. the problem is that foreach binding inside wjFlexChart block doesn't work at all. here's my code:
View:
<div data-bind="wjFlexChart: { itemsSource: data, bindingX: 'week' }">
<div data-bind="foreach: $data.legend">
<div data-bind="wjFlexChartSeries: { name: name, binding: value}"></div>
</div>
</div>
ViewModel:
data = new wijmo.collections.ObservableArray();
weeks = 'wk1,wk2,wk3,wk4,wk5,wk6,wk7,wk8'.split(',');
...
for (var i = 0; i < this.weeks.length; i++) {
this.data.push({
week: this.weeks[i],
legend: [{
name: 'name1_'+i,
value: Math.random() * 10
},{
name: 'name2_'+i,
value: Math.random() * 10
}]
});
}
Any ideas?