PDA

View Full Version : Legend does not show for piechart??



pitviper202002
28 Aug 2009, 12:03 AM
Hi ,

I am unable to show legend for my piechart.My code is as follows

Ext.onReady(function() {

var projectData = [
['PJT342', 'A', 'Sam',
'1/1/2009', '8/1/2009', 68, 300000, 20000],
['PJT342', 'B', 'James', '1/1/2009',
'8/1/2009', 21, 740000, 40000],
['PJT342', 'C', 'Drake', '1/1/2009', '8/1/2009',
48, 560000, 60000],
['PJT342', D', 'Carl', '1/1/2009', '8/1/2009',
67, 4500000, 100000],
['PJT342', 'E', 'D', '1/1/2009',
'8/1/2009', 42, 500000, 20000],
['PJT342', 'F', 'Gath', '1/1/2009',
'8/1/2009', 12, 4300000, 67000]];

var projectStore = new Ext.data.SimpleStore({
fields : [{
name : 'projectCode'
}, {
name : 'projectName'
}, {
name : 'pmName'
}, {
name : 'pjtStartDate'
}, {
name : 'pjtEndDate'
}, {
name : 'projectStatus'
}, {
name : 'projectRange'
}, {
name : 'projectRevUtil'
}

]
});
/*
* var projectStore = new Ext.data.SimpleStore({ fields : [{ name : 'name',
* type : 'string' }, { name : 'visits', type : 'int' }, { name : 'views',
* type : 'int' }] });
*
* var projectData = [['Aug 07', 24,53], ['Jul 07', 24,34], ['Nov 07',
* 49,21], ['Feb 07', 30,89],['Jan 07', 40,47],['Jun 07', 20,29]];
*/
projectStore.loadData(projectData)

var projectDashboard = new Ext.Panel({
id : 'projectDashboard',
title : 'Dashboard',
renderTo : 'centerpanel',
hidden : true,
frame : true,
height : 550,// 480
autoScroll : true,
layout : 'table',
layoutConfig : {
columns : 3
},
items : [new Ext.grid.GridPanel({
title : 'Project Status Report',
frame : true,
autoScroll : true,
height : 160,
colspan : 3,
store : projectStore,
id : 'projectChartGrid',
columns : [{
header : "Project Code",
sortable : true,
dataIndex : 'projectCode',
width : 100
}, {
header : "Project Name",
sortable : true,
dataIndex : 'projectName',
width : 180
}, {
header : "Manager Name",
sortable : true,
dataIndex : 'pmName',
width : 180
}, {
header : "Project Start Date",
sortable : true,
dataIndex : 'pjtStartDate',
width : 100
}, {
header : "Project End Date",
sortable : true,
dataIndex : 'pjtEndDate',
width : 100
}, {
header : "%Complete",
sortable : true,
dataIndex : 'projectStatus',
width : 80
}]
}), new Ext.Panel({
title : 'Project By Status',
width : 270,
frame : true,
layout : 'fit',
id : 'projectChart',
items : [{
xtype : 'piechart',
id : 'projectChartPie',
store : projectStore,
url : 'ext3/resources/charts.swf',
dataField : 'projectStatus',
categoryField : 'projectName',
extraStyle : {
legend : {
display : 'bottom',
padding : 5,
font : {
family : 'Tahoma',
size : 13
}
}
}

}]
}), new Ext.Panel({
title : 'Project by Range',
width : 270,
frame : true,
layout : 'fit',
id : 'projectDefects',
items : [{
xtype : 'piechart',
id : 'projectDefects',
store : projectStore,
url : 'ext3/resources/charts.swf',
dataField : 'projectRange',
categoryField : 'projectName',
extraStyle : {
legend : {
display : 'bottom',
padding : 5,
font : {
family : 'Tahoma',
size : 13
}
}
}

}]
}), new Ext.Panel({
title : 'Project by Revenue Utilization',
width : 270,
frame : true,
layout : 'fit',
id : 'projectTEST',
items : [{
xtype : 'piechart',
id : 'projectTestChart',
store : projectStore,
url : 'ext3/resources/charts.swf',
dataField : 'projectRevUtil',
categoryField : 'projectName',
extraStyle : {
legend : {
display : 'bottom',
padding : 5,
font : {
family : 'Tahoma',
size : 13
}
}
}

}]
}), {
xtype : 'fieldset',
colspan : 3,
// border:false,
buttons : [{
text : 'Refresh',
iconCls : 'reset',
id : 'projectResetBtn'
}, {
text : 'Close',
iconCls : 'close',
id : 'projectCloseBtn',
handler : function() {
projectDashboard.hide();
}
}],
buttonAlign : 'center'
}]

})
Ext.getCmp('projectChartGrid').on('rowclick', function() {
Ext.getCmp('projectDashboard').hide();
Ext.getCmp('projectDetailPanel').show();
})
});Please help

pitviper202002
28 Aug 2009, 2:24 AM
Can anybody guide me Please

steffenk
28 Aug 2009, 2:44 AM
please edit your first post and use code boxe

pitviper202002
30 Aug 2009, 9:23 PM
Have edited the 1st post now can anybody help please

pitviper202002
31 Aug 2009, 1:53 AM
Can anybody point out waht is wrong with the above code

pitviper202002
31 Aug 2009, 9:29 PM
Can anybody help me please im not able to show legend for my charts ,whereas in the samples legend is present???????

Regards,
Viper

pitviper202002
16 Sep 2009, 1:28 AM
Can anybody help me with this????