我似乎对传说中的更新有问题
当存储中的数据发生变化时,饼图会更新,但图例不会。
但令人惊讶的是,当我们重置饼图时它会更新一次,就像在交互中使用重置选项一样。
我不知道为什么图例本身没有更新的确切问题。
当我为商店使用硬代码值时,图例本身就会更新。对于动态值,只有图例最初没有更新。
请参考我的代码的某些部分,
PieChart = new Ext.chart.Chart( {
cls: 'pie1',
theme: 'Demo',
store: store1
shadow: true,
animate: true,
legend: {
position: 'top'
// dock: false
},
interactions: [ {
type: 'reset',
confirm: true
}],
series:
[ {
type: 'pie',
renderer: function(sprite, storeItem, barAttr, m, store11) {
barAttr.fill = colors1[m % colors1.length];
return barAttr;
},
field: 'data1',
showInLegend: true,
highlight: false,
donut: 15,
listeners: {
'labelOverflow': function(label, item) {
item.useCallout = true;
}
},
callouts: {
renderer: function(callout, storeItem) {
callout.label.setAttributes( {
text: storeItem.get('Horizontal')
}, true);
},
filter: function() {
return false;
},
box: {
//no config here.
},
lines: {
'stroke-width': 2,
offsetFromViz: 10
},
label: {
font: 'italic 14px Arial'
},
styles: {
font: '14px Arial'
}
},
label: {
field: 'Horizontal',
display: 'rotate',
font: '5px Arial'
}
}]
有任何想法吗?