Displaying graphs/charts in Django

super9 picture super9 · Apr 12, 2011 · Viewed 64.6k times · Source

I'm making a report app in Django that involves plenty of graphs and charts.

Is there an easy graphing library/module that allows me to achieve this workflow:

  1. Execute my SQL queries
  2. Parse the returned data to the graphing library/module
  3. Graphing library/module manipulates the data into a chart/graph which I can output to a Django template easily.

I've spent the last couple of days playing around with Matplotlib and Django. There are seemingly only a few ways to get the graphs to render in Django.

  1. Use 2 views, one to render the PNG and the other one to output the HTML with the img src pointing to the first view. Link
  2. Data URI's
  3. Write the image to file and then call it with the view

Is there anyway I can do this more easily?

Thanks

Answer

shabda picture shabda · May 29, 2013

You might want to look at

Django Graphos

It supports lot of backends, and integrates well with Django orm, but can work with other data sources too.

Chart types supported

Flot
  • Line chart
  • Bar Chart
  • Point Chart
Google Charts
  • Line chart
  • Column chart
  • Bar chart
  • Candlestick charts
  • Pie chart
YUI
  • Line chart
  • Column chart
  • Bar chart
  • Pie chart
Morris.js
  • Line chart
  • Column chart
  • Donut chart

[Disclosure: I am one of the authors]