1
我首先尝试使用xtype将饼图呈现为具有边框布局的面板的中心区域。下面是代码:使用xtype和Ext.create呈现饼图
{
xtype:'pie',
renderTo: Ext.getBody(),
width: 200,
height: 150,
animate: true,
layout:'fit',
store: store,
theme: 'Base:gradients',
series: [{
type: 'pie',
field: 'salary',
showInLegend: true,
highlight: {
segment: {
margin: 20
}
},
label: {
field: 'name',
display: 'rotate',
contrast: true,
font: '18px Arial'
}
}]
}
我收到以下错误:
Uncaught TypeError: Cannot call method 'substring' of undefined
但是,当我采取相同的代码,并使用Ext.create然后它工作正常。
var chart=Ext.create('Ext.chart.Chart', {
renderTo: Ext.getBody(),
width: 200,
height: 150,
animate: true,
layout:'fit',
store: store,
theme: 'Base:gradients',
series: [{
type: 'pie',
field: 'salary',
showInLegend: true,
highlight: {
segment: {
margin: 20
}
},
label: {
field: 'name',
display: 'rotate',
contrast: true,
font: '18px Arial'
}
}]
});
我使用图表作为项目来代替。
可能是什么问题?
这里是商店:
var store=Ext.create('Ext.data.Store',{
model:'Layouts.Person',
autoLoad:true,
data:{'items':[
{'name':'john','empno':'1111','salary':'1234'},
{'name':'edward','empno':'1212','salary':'2234'},
{'name':'frank','empno':'1567','salary':'9774'},
{'name':'michel','empno':'3456','salary':'8932'},
]},
proxy:{
type:'memory',
reader:{
type:'json',
root:'items'
}
}
});
的饼图的是的xtype馅饼:
http://www.objis.com/formationextjs/lib/extjs-4.0.0/docs/api/Ext.chart.series.Pie.html
互动:[ '旋转', 'itemhighlight'],在ExtJS的炭 –
工作不适合这个问题的任何解决方案? –