PDA

View Full Version : [CMD+ExtJS] Problem with Charts only in build



rafaelrp
21 May 2015, 8:50 AM
Hello!

I'm having some trouble with Charts only in build, in dev works fine with no errors.

This is the error that console returns:

Uncaught TypeError: Cannot read property 'length' of undefined


This is the Chart view:


Ext.define("MyApp.view.Chart", {
extend: 'Ext.chart.Chart',


xtype: 'mychart',
layout: 'fit',


style: 'background:#fff',
animate: true,
shadow: true,
requires : [
'MyApp.store.ChartStore'
],


store: {
type: 'mystore'
},
axes: [{
type: 'Numeric',
position: 'left',
fields: ['number'],
// label: {
// // renderer: Ext.util.Format.numberRenderer('0.0')
// },
title: 'Vel',
grid: true,
minimum: 0
}, {
type: 'Category',
position: 'bottom',
fields: ['data']
// title: 'Data'
}],
series: [
{
type: 'column',
axis: 'left',
highlight: true,
tips: {
trackMouse: true,
width: 160,
height: 28,
renderer: function(storeItem, item) {
this.setTitle(storeItem.get('data') + ': ' + storeItem.get('number'));
}
},
renderer: function(sprite, storeItem, barAttr, i, store) {
barAttr.fill = '#225885';
return barAttr;
},
label: {
display: 'insideEnd',
'text-anchor': 'middle',
font: '1em bold arial, verdana',
field: 'number',
renderer: function(v){
return Ext.String.format(v.toFixed(2).toString().replace('.',','));
},
orientation: 'vertical',
color: '#fff'
},
xField: 'data',
yField: 'number'
}
]
});




And this is the Store:


Ext.define('MyApp.store.ChartStore', {
extend: 'Ext.data.Store',


model: 'MyApp.model.ChartStore',
alias : 'store.mystore',


autoLoad: false,
groupField: 'name',


// pageSize: 25,


proxy: {
type: 'ajax',
api: {
read: 'resources/data/ajx_list_chart.php'
},
reader: {
type: 'json',
root: 'data',
// totalProperty: 'total',
successProperty: 'success'
},
writer: {
type: 'json',
root: 'data',
encode: true
}
}
});




Thanks! ~o)~o)

Gary Schlosberg
22 May 2015, 12:55 PM
What version of Cmd are you running? What specific version of Ext JS?

rafaelrp
25 May 2015, 3:53 AM
I'm using ExtJS 4.2 and Sencha Cmd v4.0.4.84Thanks

rafaelrp
2 Jun 2015, 5:25 AM
up

Gary Schlosberg
5 Jun 2015, 3:48 PM
Are you seeing any errors from Cmd during the build? What does your data look like?

rafaelrp
8 Jun 2015, 5:37 AM
No errors occured during the build.
The response is a simple json like:


{"data":[{"number":"39.96","data":"04\/06\/2015"}]}


~o)

Gary Schlosberg
9 Jun 2015, 1:30 PM
read: 'resources/data/ajx_list_chart.php'



Are you certain that your production build is able to access your relative URL?

rafaelrp
9 Jun 2015, 4:16 PM
Yes, because i have a grid that loads this store too and everything is normal

rafaelrp
23 Jun 2015, 10:57 AM
up!It's possible that is a bug?

rafaelrp
3 Jul 2015, 5:30 AM
up! ~o):)