PDA

View Full Version : [EXTJS 4.2.2] Pie chart not rendering



jeremys
15 Mar 2016, 2:34 AM
Hello everybody,

I have a problem with pie chart after build my application.
Version of the extjs is 4.2.2
Version of the cmd is 4.0.2.67


"TypeError : j.initialize is not a function"

54177

Can somebody help me?

Code of the chart is :



{
xtype:'chart',
renderTo: Ext.getBody(),
legend:false,
width:120,
height:120,
animate: true,
store: 'PagesCountDetailsPieStore',
itemId:'pieChartProjectDetailsDashboard',
shadow:false,
series: [{
type: 'pie',
donut:60,
angleField: 'data'
}]
}


And the store is :



Ext.define('Saas.store.PagesCountDetailsPieStore',{
extend:'Ext.data.JsonStore',
storeId:'pageCountDetailsPieStoreItemId',
autoLoad:true,
fields:['name','data'],
data: [
{ 'name': 'metric one', 'data': 10 },
{ 'name': 'metric two', 'data': 7 },
{ 'name': 'metric three', 'data': 5 },
{ 'name': 'metric four', 'data': 2 },
{ 'name': 'metric five', 'data': 27 }]


});

Gary Schlosberg
15 Mar 2016, 8:24 AM
Are you able to recreate this issue in a test case or does it only occur when you build your application?
https://fiddle.sencha.com/#home

jeremys
15 Mar 2016, 8:39 AM
Hi Gary,

This error occurs only when I build my application.

I found the function where the error occurs in the ext-all.js :


initializeSeries: function(j, m, a) {
var k = this,
g = k.themeAttrs,
d, h, o, q, p, n = [],
e = (j instanceof Ext.chart.series.Series).i = 0,
c, b;
if (!j.initialized) {
b = {
chart: k,
seriesId: j.seriesId
};
if (g) {
o = g.seriesThemes;
p = g.markerThemes;
d = Ext.apply({}, g.series);
h = Ext.apply({}, g.marker);
b.seriesStyle = Ext.apply(d, o[a % o.length]);
b.seriesLabelStyle = Ext.apply({}, g.seriesLabel);
b.markerStyle = Ext.apply(h, p[a % p.length]);
if (g.colors) {
b.colorArrayStyle = g.colors
} else {
n = [];
for (c = o.length; i < c; i++) {
q = o[i];
if (q.fill || q.stroke) {
n.push(q.fill || q.stroke)
}
}
if (n.length) {
b.colorArrayStyle = n
}
}
b.seriesIdx = m;
b.themeIdx = a
}
if (e) {
Ext.applyIf(j, b)
} else {
Ext.applyIf(b, j);
j = k.series.replace(Ext.createByAlias("series." + j.type.toLowerCase(), b))
}
}
j.initialize();
j.initialized = true;
return j
},

jeremys
17 Mar 2016, 3:19 AM
Just added



requires:[ 'Ext.chart.series.Pie',
'Ext.chart.series.Series',
'Ext.chart.Chart'
]

and it works.

Gary Schlosberg
17 Mar 2016, 3:04 PM
Glad to hear you've found the solution, and thanks for sharing.