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, orderby=db.com_house_stock.CompanyNumber) return dict(dashboard_data=dashboard_data) def visualisation(): return dict(message=T('Test dashboard')) And just in case, the visualisation.html code (at the moment I am just trying to make the code show a table, with just one column of data, get this to work before I move onto anything more complicated!): {{ response.files.append(URL('static','js/d3.js')) response.files.append(URL('static','js/crossfilter.js')) response.files.append(URL('static','js/dc.js')) }} {{extend 'layout.html'}} <h1>Open source data dashboard</h1> <p>Pie chart displaying percentages of each category in the database</p> <div class='container' style='font: 12px sans-serif;'> <div class='row'> <div class='span12'> <table id='dc-table-graph'> <thead> <tr class='header'> <th>IncDate</th> </tr> </thead> </table> </div> </div> </div> <script> {{# create dc.js chart object & link to DIV}} var dataTable = dc.dataTable("#dc-table-graph"); {{# load data}} d3.json("{{=URL('default', 'dashboard_data.json')}}", function (data) { {{# format data}} var dtgFormat = d3.time.format("%d/%m/%Y"); data.forEach(function (d) { d.incdate = dtgFormat.parse(d.IncorporationDate); }); {{# run data through crossfilter}} var facts = crossfilter(data); {{# Create dataTable dimension}} var timeDimension = facts.dimension(function (d) { return d.incdate; }); dataTable.width(960).height(800) .dimension(timeDimension) .group(function(d) { return "Table" }) .size(10) .columns([ function(d) { return d.incdate; } ]) .sortBy(function(d){ return d.incdate; }) .order(d3.ascending); dc.renderAll (); }); </script> Thanks for any pointers you can give!!! On Tuesday, 20 May 2014 17:36:04 UTC+1, Andrew W wrote: > > 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 received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
dashboard_data.json
Description: Binary data