[web2py] Re: D3.js calling Json in View

2014-05-26 Thread thehuman trashcan
Ah right - that makes sense. Thanks again ;-) On Saturday, 24 May 2014 03:55:39 UTC+1, Andrew W wrote: good work. data just refers to the dictionary. When you open up your json file you just see a dictionary with one key that points to an array. By saying data.dashboard_data you are then

[web2py] Re: D3.js calling Json in View

2014-05-23 Thread thehuman trashcan
Thank you so much Andrew - you have given me plenty to work on... When I'm back I'll give these a go and let you know how I get on. Many thanks again On Friday, 23 May 2014 05:41:16 UTC+1, Andrew W wrote: Also, try scheme='https' in your case. See Core chapter of book. -- Resources: -

[web2py] Re: D3.js calling Json in View

2014-05-23 Thread thehuman trashcan
In my impatience I just quickly edited the file. data.dashboard_data is all that was needed. I have managed to leave Scheme=true. I don't fully understand how data.dashboard_data converts my dictionary to an array, but I will be looking into this to understand. In any case, thank you ever so

[web2py] Re: D3.js calling Json in View

2014-05-23 Thread Andrew W
good work. data just refers to the dictionary. When you open up your json file you just see a dictionary with one key that points to an array. By saying data.dashboard_data you are then directly referencing the value of the key, ie. the array in the dictionary. There are several ways to do

[web2py] Re: D3.js calling Json in View

2014-05-22 Thread thehuman trashcan
Hi Andrew, The URL line now says: d3.json({{=URL('default', 'dashboard_data.json', scheme=True, host=True)}} , function (data) { This doesn't make the information come back though. Does it matter that I am using pythonanywhere - it looks like they have https:// in place? Thanks!! On

[web2py] Re: D3.js calling Json in View

2014-05-22 Thread Andrew W
I'm not at a desktop machine so I'll be brief. D3 expects an array, you have provided a dict. When you reference data such as in the foreach, try data.dashboard_data which will reference the array. Syntax is probably not quite correct. Also, if you're not sure add console.log stmts to show the

[web2py] Re: D3.js calling Json in View

2014-05-22 Thread Andrew W
Also, try scheme='https' in your case. See Core chapter of book. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you

[web2py] Re: D3.js calling Json in View

2014-05-21 Thread Andrew W
In the URL() call, add scheme=True, host=True. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to

[web2py] Re: D3.js calling Json in View

2014-05-21 Thread thehuman trashcan
Hi Andrew, The JSON output is attached (I just grabbed the first 250 lines of some public data). My controller code: def dashboard_data(): dashboard_data = db().select(db.com_house_stock.CompanyNumber, db.com_house_stock.IncorporationDate, db.com_house_stock.CompanyCategory,

[web2py] Re: D3.js calling Json in View

2014-05-20 Thread Anthony
When you manually go to /yourapp/default/dashboard_data.json, do you get the JSON you expect? If so, when you load the page in question, if you watch the network activity in the browser developer tools, do you see an Ajax request successfully pulling in that JSON? If all that works, then the

[web2py] Re: D3.js calling Json in View

2014-05-20 Thread Andrew W
I use this technique regularly. Show the controller code and/or json output and I'll have a look. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You

[web2py] Re: D3.js calling Json in View

2014-05-20 Thread thehuman trashcan
Thanks Anthony, When I manually load the JSON file I do see the correct data. The Network activity (I am using Chrome) seems to show that it pulled the JSON file back ok. But I cannot see an Ajax request?? I do see that the D3.JS returns with a 304 status, NOT MODIFIED. Thanks for your