<select name="type" class="form-control">
    {% for label, chart_group in charts_config.items() %}
        <optgroup label="{{ label }}">
            {% if chart_group['enabled'] %}
                {% for chart in chart_group['charts'] %}
                    {% set value, chart_label = chart[0], chart[1] %}
                    <option value="{{ value }}">{{ chart_label }}</option>
                {% endfor %}
            {% endif %}
        </optgroup>
    {% endfor %}
</select>
