{% macro plot_grid(array_element, subitem, active_subitem, rows, cols, plot_titles, max_plots_row, plot_errors=None, plot_keys=None) %}
{% for title in plot_titles %} {% set idx = loop.index0 %} {% set plot_key = plot_keys[idx] %} {% if idx % max_plots_row == 0 %}
{% endif %}
2 %}"col-xl-4 col-lg-6 col-md-12 mb-3"{% endif %}>
{% set plot_has_error = plot_errors and plot_errors.get(plot_key) %} {# Mark invalid plots so plot.js can skip overwriting the server error. #}
{# style="height: 300px;" #} {% if plot_has_error %}
Plot configuration error: {{ plot_errors.get(plot_key) }}
{% else %}
Placeholder for {{ array_element }} {{ subitem }} plot {{ title }}
{% endif %}
{% if idx % max_plots_row == max_plots_row - 1 %}
{% endif %} {% endfor %}
{% endmacro %}