PDA

View Full Version : My Pie chart doesn't load my store



GBenji
22 Feb 2012, 5:04 AM
I have a store named 'Resources' used in a grid (so i'm sure that the store work and there are 8 lines in), but I wanna do a PieChart with this same store and... I have no error but no PieChart too :-/

my view :

Ext.require('Ext.chart.*');
Ext.define('poar.view.piechart.PieChart',{
extend: 'Ext.chart.Chart',
alias: 'widget.piechartPanel',
loadMask:true,
height: 600,
store : 'Resources',
series : [{
type: 'pie',
angleField: 'state'
}],
initComponent: function() {
this.callParent(arguments);
}
});


my controller :

Ext.define('poar.controller.PieChart', {
extend: 'Ext.app.Controller',

views: [
'piechart.PieChart'
],
stores: [
'Resources'
]
});


When I add this in my PieChart's view :

listeners : {
'render':function(){
console.log(this);
}


It writes that :

constructor

axes: constructor
border: 0
componentCls: "x-surface"
componentLayout: constructor
container: constructor
el: constructor
events: Object
height: 600
hidden: true
hiddenAncestor: false
id: "pchart-panel"
initialConfig: Object
lastBox: Object
listeners: null
loader: null
maxGutter: Array[2]
mons: Array[0]
originalStore: "Resources"
ownerCt: constructor
ownerLayout: constructor
protoEl: null
renderData: Object
renderSelectors: Object
rendered: true
series: constructor
showOnParentShow: false
stateEvents: Array[0]
stateId: undefined
store: constructor

data: constructor

allowFunctions: false
events: Object
getKey: function (record) {
items: Array[0]
keys: Array[0]
length: 0
map: Object
sorters: constructor
__proto__: TemplateClass

events: Object
filters: constructor
groupers: constructor
implicitModel: true
listeners: null
model: function constructor() {
modelDefaults: Object
pageSize: 25
proxy: constructor
removed: Array[0]
sorters: constructor
storeId: "Resources"
__proto__: TemplateClass

storeListeners: Object
surface: constructor
themeAttrs: constructor
ui: "default"
xtype: "piechartPanel"
zoom: Object
__proto__: TemplateClass
As you can see, there are 0 lines of data in the store.

mitchellsimoens
22 Feb 2012, 5:57 AM
The chart isn't going to do the loading for you, you have to tell the store to load.

GBenji
22 Feb 2012, 6:19 AM
The store is already load, cause my grid show this store.

mitchellsimoens
22 Feb 2012, 6:25 AM
If the grid shows data but the pie doesn't then you are not using the same store instance.

GBenji
22 Feb 2012, 6:28 AM
My fault, you're right : I didn't load the store in my chart... done now.

But now i have this error :
Error: Problem parsing d="M589,300LNaN,NaNA290,290,0,0,1,NaN,NaNLNaN,NaNA290,290,0,0,1,NaN,NaNLNaN,NaNL589,300Z"

GBenji
28 Feb 2012, 6:08 AM
up :-/

GBenji
29 Feb 2012, 12:13 AM
UP :-/

For remember :

I wanna show a piechart with the information of a store (field 'state').
Now it's loaded but when i show the piechart i have this error :


Error: Problem parsing d="M589,300LNaN,NaNA290,290,0,0,1,NaN,NaNLNaN,NaNA290,290,0,0,1,NaN,NaNLNaN,NaNL589,300Z"




My store is like that :





data: constructor

allowFunctions: false
events: Object
generation: 18
getKey: function (record) {
items: Array[8]

0: constructor

data: Object

api_timestamp: "1330502656"
available_upto: "2147483647"
id: "1"
network_address: "node1"
state: "Alive"
__proto__: Object

dirty: false
events: Object
id: "Ext.data.Store.ImplicitModel-Resources-1"
index: 0
internalId: 1
modified: Object
phantom: false
raw: Object
stores: Array[1]
__proto__: TemplateClass





And my PieChart.js is like that :


/*Integrating the drawgantt chart */
Ext.require('Ext.chart.*');

Ext.define('poar.view.piechart.PieChart',{
extend: 'Ext.chart.Chart',
alias: 'widget.pieChartPanel',
loadMask:true,
height: 600,
store : 'Resources',
series : [{
type: 'pie',
angleField: 'state',
//showInLegend: true
}],

initComponent: function() {
this.callParent(arguments);
}
});

ricardo.hrc
15 May 2012, 12:15 PM
I'm having the same problem with a pie chart. Anyone knows how to fix this? Thanks.

GBenji
24 May 2012, 5:16 AM
I fixed this there is a long time ago.

I'll come back tomorrow to show how i did it.