Note that there are some explanatory texts on larger screens.

plurals
  1. POExtJS 3 and Highcharts, JsonStore problem while loading data
    text
    copied!<p>i'm trying to chart some data using Highcharts in a EXTJS 3 window. With a fixed array of data everything works but i need to chart data taken from a python cgi which returns a json. This is how the python cgi creates my data (a slice of, i skipped the connection to the db and so on):</p> <pre><code> query = "select timestamp, value from "+measure_table+" where id_resource = 280 and timestamp &lt; '2011-07-13 03:59:00'" #execute the query cur.execute(query) rows = cur.fetchall() #create the empty json data rpeository to be filled in json_root = { 'fields': ['timestamp', 'value'], 'data':[] } for row in rows: json_root['data'].append({'timestamp':str(row[0]), 'value':row[1]}) #spit out the json and we are done! req.write(str(json_root)) </code></pre> <p>And this is the js in which i try to load this data:</p> <pre><code> var jproxy = new Ext.data.HttpProxy({ url: 'the url where to find the cgi' }); var jstore = new Ext.data.Store({ proxy: jproxy, reader: new Ext.data.JsonReader({ idProperty: 'timestamp', root: 'data', fields: [ {name: 'timestamp', mapping: 'timestamp'}, {name: 'value', mapping: 'value'}, ] }) }); </code></pre> <p>Then i create the window and the chart. 2 questions now: the 1st is quite simple: what's wrong with this code? firebug console says: </p> <blockquote> <p>o is undefined</p> <p>if(o.metaData){ </p> </blockquote> <p>at line 26042 of ext-all-debug.js, one of the debug scripts i've included in my html header. The window is already created but of course there's no chart in it. Which kind of error is this? if i comment with a big /* .... */ the creation of the proxy and the store the error disappears, so the problem should be there. EDIT: i've fixed this very problem, i loaded the store with the wrong function..i was using jstore.loadData() instead of jstore.load(), my fault..sorry</p> <p>The second question is: is this (the following code) the correct way to chart data with highcharts from a jsonstore? (we are within the chart creation, i don't post the entire code 'cause it works and probably it's not useful to post it)</p> <pre><code> xField: 'timestamp', store: jstore, series: [{ yField: 'value' }] } </code></pre> <p>Many many thanks for any answer!</p> <p>EDIT: new problem after i fixed the loading of the data:</p> <pre><code>too much recursion jqextend(),DanaI...xtjs.js (riga 81) merge(),DanaI...xtjs.js (riga 92) Chart (),DanaI....src.js (riga 3922) options = Object { chart={...}, title={...}, altri elementi...} callback = undefined draw(),DanaI...hart.js (riga 229) call(),DanaI...ebug.js (riga 1547) , copy); </code></pre> <p>This is firebug console output..too much recursion? which recursion? I'm not using any recursive function in my code..</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload