PDA

View Full Version : NaN in chart



TobyJustus
16 Apr 2012, 12:40 AM
I create a chart like this:


//create chart if (rec.get('charts') == null) {
console.log('no chart available');
} else {
console.log('chart needed: creating chart');
//create dynamic chart
var chartAxes = [];
var chartSeries = [];
Ext.Array.each(rec.get('charts'), function (name, index, Charts) {
//chartname
var chartName = name.name.toLowerCase();
//chartType
var chartType = name.type.toLowerCase();
console.log('chart: creating axes');
Ext.Array.each(name.axes, function (nameAxes, indexAxes, ChartsAxes) {


var this_chartAxes = {};
this_chartAxes['type'] = nameAxes.type.toLowerCase();
if(nameAxes.type.toLowerCase() == 'numeric') {
var chartAxesFields = [];

Ext.Array.each(nameAxes.fields, function (name, index, charts) {
var this_chartSeries = {};
this_chartSeries['type'] = chartType;
this_chartSeries['yField'] = [name];
this_chartSeries['xField'] = chartYfield;
this_chartSeries['smooth'] = 3;


chartSeries.push(this_chartSeries);
chartAxesFields.push(name);
})
} else if (nameAxes.type.toLowerCase() == 'category') {
var chartAxesFields = [];

Ext.Array.each(nameAxes.fields, function (name, index, charts) {
chartYfield = name.toLowerCase();
chartAxesFields.push(name);
})
}
console.log(chartAxesFields);



this_chartAxes['fields'] = chartAxesFields;
this_chartAxes['position'] = nameAxes.position.toLowerCase();


this_chartAxes['title'] = nameAxes.title;
chartAxes.push(this_chartAxes);


});
console.log(chartAxes);
console.log('chart: axes created');

});




Only problem is that i get a NaN in the left axes. How can i solve this?

TobyJustus
16 Apr 2012, 6:06 AM
how does a axes and series need to look like ?

TobyJustus
16 Apr 2012, 11:03 PM
An example
34104