项目需要用ExtJS绘制饼图,但我刚接触Extjs,谁可以给我个范例看看。
Mail:vetian@163.com
有好的加分. 展开
无论怎么画还是要用到js
不如引用下其他版本的个文件。extjs低级的不支持。这个是比较低级的。。
我的这个是3.31
Ext.chart.Chart.CHART_URL = '../../resources/charts.swf';
Ext.onReady(function(){
var store = new Ext.data.JsonStore({
fields: ['season', 'total'],
data: [{
season: 'Summer',
total: 150
},{
season: 'Fall',
total: 245
},{
season: 'Winter',
total: 117
},{
season: 'Spring',
total: 184
}]
});
new Ext.Panel({
width: 400,
height: 400,
title: 'Pie Chart with Legend - Favorite Season',
renderTo: 'container',
items: {
store: store,
xtype: 'piechart',
dataField: 'total',
categoryField: 'season',
//extra styles get applied to the chart defaults
extraStyle:
{
legend:
{
display: 'bottom',
padding: 5,
font:
{
family: 'Tahoma',
size: 13
}
}
}
}
});
});
参考资料: extjs3.31
title: '饼状图',
width: 500,
height: 300,
layout: 'fit',
x: 100,
y: 100,
items: {
xtype: 'piechart',
store: store,// store
categoryField: 'name',
dataField: 'visits',
xField: 'name',
yField: 'visits',
extraStyle:
{
legend:
{
display: 'bottom',
padding: 5,
font:
{
family: 'Tahoma',
size: 13
}
}
}
}
});
bing.show();
var store = new Ext.data.JsonStore({
url: url,
fields: ['name', 'visits']
});