我有一个饼图和一个显示在它下面的网格,两者都使用同一个商店。
而且,在商店里,我有以下字段:
总计,分配,使用,剩余。
是否可以使饼图只有四个中的三个字段,因为我不希望总字段出现在饼图中,但网格应该有它。所以,有谁能告诉我最好的方法是什么?
代码如下:
饼图
var chart1 = Ext.create('Ext.chart.Chart', {
id : 'chart1',
xtype : 'chart',
theme : '',
animate : true,
shadow : true,
height : 250,
width : 250,
store : LicSumStore,
series : [{
type : 'pie',
angleField : 'value',
showInLegend : true,
highlight :{
segment :{
margin :20
}
} ,
label : {
field : 'title',
display :'rotate',
contrast : true,
font : '12px Arial'
},
title : 'Licenses',
}],
});
网格
var licSummaryGrid = Ext.create('Ext.grid.Panel',{
title :'LicenseSummary',
store : LicSumStore,
enableColumnResize : false,
columns : [
{
text : 'License Type',
dataIndex : 'title',
width : 150,
sortable : false,
hideable : false,
},
{
text : 'Count',
dataIndex : 'value',
width : 100,
sortable : false,
hideable : false,
}
],
height : 180,
width : 255
});
答案 0 :(得分:0)
通过使用摘要类型添加网格中的总字段,而不是修改饼图中的数据来解决此问题。因此,我摆脱了商店中的总字段,并在网格中计算出来。
以下是代码:
{
text: 'License Type',
dataIndex: 'title',
width: 150,
sortable: false,
hideable: false,
summaryRenderer: function () {
return Ext.String.format('Total');
}
}, {
text: 'Count',
dataIndex: 'value',
width: 100,
sortable: false,
hideable: false,
summaryType: 'sum'
}