{% if chart.color_list %} var mycolor = new Array(); {% for color in chart.color_list %} mycolor[{{ loop.index - 1}}] = "{{ color }}"; {% endfor %} {% endif %} chart .x(function(d) { return d.label }) .y(function(d) { return d.value }); {% if chart.width %} chart.width({{ chart.width }}); {% endif %} {% if chart.height %} chart.height({{ chart.height }}); {% endif %} {% if chart.color_list %} chart.color(mycolor); {% endif %}