PDA

View Full Version : Extjs Chart Numeric Y Axis Nan values



JuanAlbertoMtz
7 May 2014, 8:43 AM
I have a problem when I create a extjs Chart, the y axis is showing nan values, as you can see in the image.

48941

This is how I am creating the chart, first I create the store:




Ext.define('DDM', { extend: 'Ext.data.Model', fields: ["REASON", "DELAY_CODE", "FREQUENCY", "MAX", "MIN", "AVG"]});Ext.create('Ext.data.Store', { id: 'dsChart', autoLoad: true, model: 'DDM', data: [], remoteSort: false, fields: ["REASON", "DELAY_CODE", "FREQUENCY", "MAX", "MIN", "AVG"] });

At this point I don't have the data, because I am retrieving the data dynamically.
Then I create the chart:




Ext.create('Ext.panel.Panel', {id: "panel1",width: 800,height: 600,top: 10,left: 10,renderTo: "demoChart",title: "Chart", items: [{ xtype: 'chart', id: "chart1",store: dsChart,border: 1,width: 750,height: 500, axes: [{ position: 'left', fields: ['FREQUENCY'], type: 'Numeric', title: 'Frequency', grid: true }, { position: 'bottom', fields: ['REASON'], type: 'category', title: 'Reason', grid: true }], series: [{ yField: 'FREQUENCY', xField: 'REASON', type: 'column', axis: 'left', highlight: true }] }]});

Then I retrieve the data and this is what I get:



Ext.define('DDM', { extend: 'Ext.data.Model', fields: ["REASON", "DELAY_CODE", "FREQUENCY", "MAX", "MIN", "AVG"]});Ext.create('Ext.data.Store', { id: 'dsChart2', autoLoad: true, model: 'DDM', remoteSort: false, fields: ["REASON", "DELAY_CODE", "FREQUENCY", "MAX", "MIN", "AVG"],data: [ ["Broken electrode","010111",1,0.17,0.17,0.17,0.17],["Double Slag","010118",1,0.30,0.30,0.30,0.30],["OTHER","01010202",1,0.62,0.62,0.62,0.62],["Changing heat","010114",6,0.86,0.33,0.00,0.14],["Mash and mag","010106",16,1.52,0.17,0.02,0.09],["Diluting","010113",7,1.65,0.35,0.16,0.24],["Taking temperature","010124",45,1.94,0.10,0.01,0.04],["Lower roof","010121",41,1.99,0.10,0.00,0.05],["OTHER","01010201",16,2.27,0.22,0.09,0.14],["Dressing bottom","010110",18,2.68,0.51,0.05,0.15],["Changing Roof","010112",2,3.83,3.63,0.20,1.92],["Slipping electrodes","010120",145,5.28,0.28,0.01,0.04],["Adding electrodes","010104",48,9.52,0.36,0.08,0.20],["Cleaning spout","010123",67,10.23,0.55,0.02,0.15],["Inspect furnace","010122",103,11.72,0.66,0.02,0.11],["Electrical","010102",30,13.06,5.98,0.02,0.44],["Wait on ladle","010115",110,14.58,0.44,0.00,0.13],["OTHER","",67,15.26,1.95,0.02,0.23],["Operating (other) Explain","010199",60,15.49,1.70,0.00,0.26],["Gunning","010109",53,17.11,1.03,0.07,0.32],["Pushing in scrap","010119",166,18.58,0.28,0.03,0.11],["Charging furnace","010105",248,22.61,0.64,0.01,0.09],["Chem Lab","010116",287,24.62,0.56,0.00,0.09],["Carbon blow","010107",240,31.69,0.47,0.00,0.13],["Tapping heat","010108",139,34.35,0.78,0.01,0.25],["Mechanical","010103",23,48.70,14.63,0.09,2.12],["Schedule Down Turn","010117",1,63.55,63.55,63.55,63.55] ]});

And finally I update the chart store:



chart1.getChartStore().loadData(dsChart2.data.items); chart1.redraw();

The Frequency field is numeric that's why I don't understand the nan value.
I am missing something?
Thanks in advance,
Alberto

scottmartin
7 May 2014, 9:54 AM
Try defining your field as type int in your model to see if that helps