PDA

View Full Version : how to present the retrieved data on a sencha pie chat, please! Desparetly need tips



steph09
22 Mar 2013, 4:55 AM
Please, i have been searching every where for someone to help me out cos it has not been possible for me to present the data sent to my sencha pie chart from the json data store i created for this purpose :


I am displaying the below result from a printed form of my variable array countaining the following set of value:
Array ([0] => Array ( [0] => 19 [nombre] => 19 [1] => Chargé de mission [type] => Charge de mission )[1] => Array ( [0] => 204 [nombre] => 204 [1] => Pré-adhérent [type] => Pre-adherent )[2] => Array ( [0] => 1 [nombre] => 1 [1] => Administrateur [type] => Administrateur )[3] => Array ( [0] => 25 [nombre] => 25 [1] => Auto-entrepreneur [type] => Auto-entrepreneur )[4] => Array ( [0] => 1157 [nombre] => 1157 [1] => Adhérent [type] => Adherent )[5] => Array ( [0] => 429 [nombre] => 429 [1] => Salarié [type] => Salarie ))


meanwhile to send it to my sencha pie i have use the json encode as bellow:


{"success":true,"total":"0","data":[{"0":"19","nombre":"19","1":null,"type":"Charge de mission"},{"0":"204","nombre":"204","1":null,"type":"Pre-adherent"},{"0":"1","nombre":"1","1":"Administrateur","type":"Administrateur"},{"0":"25","nombre":"25","1":"Auto-entrepreneur","type":"Auto-entrepreneur"},{"0":"1157","nombre":"1157","1":null,"type":"Adherent"},{"0":"429","nombre":"429","1":null,"type":"Salarie"}]}


However to have it displayed by the sencha pie i have set my code as follow :


var userStore = new Ext.data.JsonStore({
url: 'rapport/chartTypeProfils.php',
fields: [{name:'nombre' ,type:'int'},'type'],
root: 'data'
//totalProperty:'total'


});






userPie= Ext.extend( Ext.ux.Portlet,{
constructor: function(config) {
Ext.apply(this, {
//width: 400,
height: 300,
title: 'Utilisateur',
tools: tools,
//renderTo: 'user',
items: {
itemId: 'userStore',
store: userStore,
xtype: 'piechart',
dataField: 'nombre',
categoryField: 'type',
//extra styles get applied to the chart defaults
extraStyle:
{
legend:
{
display: 'left',
padding: 5,
font:
{
family: 'Tahoma',
size: 13
}
}
}
}
});
userPie.superclass.constructor.apply(this, arguments);
}
});


but it doesn't seem to work as to display the wanted pie.....

mitchellsimoens
25 Mar 2013, 8:01 AM
What do you mean? Is it displaying something just not what you want or not displaying at all?

steph09
26 Mar 2013, 2:14 AM
Thanks in advance for your immediate reaction mitchellsimoens,

It is not showing at all..... and still can't seem to understand the reason why and would sincerely appreciate helps on figuring out the reason of the why i've been confronted to this issue, please......:-/