{# Basic SVG Plot Template for SQL Explorer #} {% set unique_id = range(1000, 9999) | random %} {# Simple unique ID for elements #}

{{ title }}

{% if plot_type == 'table' %} {# Fallback to rendering a table if plot type is not supported or data is unsuitable #}
{# Limit height and allow scroll #} {% for col in original_columns %} {% endfor %} {% for row in original_results %} {% for col in original_columns %} {% endfor %} {% else %} {% endfor %}
{{ col }}
{{ row[col] }}
No data available.
{% else %} {# SVG Plot Area #}
{# Tooltip Element #} {# Draw Axes #} {# Y Axis #} {# X Axis #} {# Draw Ticks and Grid Lines #} {# Y Ticks #} {% for tick in y_ticks %} {# Grid line #} {{ tick.label }} {% endfor %} {# X Ticks #} {% for tick in x_ticks %} {# Grid line #} {{ tick.label }} {% endfor %} {# Draw Axis Labels #} {# Y Axis Label #} {{ y_axis_label }} {# X Axis Label #} {{ x_axis_label }} {# Plot Data Points/Bars #} {% for plot in plots %} {% if plot_type == 'scatter' %} {% for p in plot.points %} {% endfor %} {% elif plot_type == 'line' %} {% for p in plot.points %} {% endfor %} {% elif plot_type == 'bar' %} {% set bar_w = bar_width | default(10) %} {% for p in plot.points %} {% endfor %} {% endif %} {% endfor %}
{% endif %}