Wijmo 5 flex chart not working with knockout foreach binding
I want to dynamically update the values (or add an extra legend item) in my chart, so I cannot use the "hardcoded" html markup from the flexchart example page . the problem is that the foreach binding inside the 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?
+3
source to share
No one has answered this question yet
See similar questions:
or similar: