Looping to provide multiple lines in linechart (django-googlecharts)

Posted by mighty_bombero on Stack Overflow See other posts from Stack Overflow or by mighty_bombero
Published on 2010-03-23T23:52:48Z Indexed on 2010/03/24 0:13 UTC
Read the original article Hit count: 706

Filed under:
|
|

Hi,

I'm trying to generate some charts using django-googlecharts. This works fine for rather static data but in one case I would like to render a different number of lines, based on a variable. I tried this:

  {% chart %}
   {% for line in line_data %}
    {% chart-data line %}
   {% endfor %}
   {% chart-size "390x200" %}
   {% chart-type "line" %}
   {% chart-labels days %}
  {% endchart %}

Line data is a list containing lists. The template code fails with "Caught an exception while rendering: max() arg is an empty sequence".

I guess the problem is that I try to loop over templatetags. What approach could be used here? Or am I completely missing something? Is this doable using inclusion tags?

Thanks for your help.

© Stack Overflow or respective owner

Related posts about python

Related posts about django