Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. def salesboard(request):
  2. # render the graph here
  3. data = [
  4. ['Year', 'Sales', 'Expenses'],
  5. [2004, 1000, 400],
  6. [2005, 1170, 460],
  7. [2006, 660, 1120],
  8. [2007, 1030, 540]
  9. ]
  10. chart = flot.LineChart(SimpleDataSource(data=data), html_id="Line Chart")
  11. return render_to_response('scoreboard.html', {'chart':chart})
  12.  
  13. Error during template rendering
  14.  
  15. In template C:UsersTIMLEU~1DesktopSYSTEM~1sp-venvlibsite-packagesgraphostemplatesgraphosflot.html, error at line 4
  16. <zip object at 0x00000052AAC8D448> is not JSON serializable
  17. 1 <div id="{{ chart.html_id }}" style="width:{{ chart.width }}px;height:{{ chart.height }}px;"></div>
  18. 2 <script type="text/javascript">
  19. 3 $(function () {
  20. 4 data{{ chart.html_id }} = {{ chart.get_series_objects_json|safe }}
  21. 5 $plot{{ chart.html_id }} = $.plot(
  22. 6 $("#{{ chart.html_id }}"),
  23. 7 data{{ chart.html_id }},
  24. 8 {{ chart.get_options_json|safe }}
  25. 9 );
  26. 10 });
  27. 11 </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement