Clean up svg_line_graph

This commit is contained in:
Peter Stockings
2023-12-11 22:02:47 +11:00
parent 197f7bcf6b
commit d54cbe1d17

View File

@@ -9,14 +9,6 @@
{% endfor %} {% endfor %}
{% endmacro %} {% endmacro %}
{% macro path_best_fit(best_fit_points, vb_height) %}
{% for value, position in best_fit_points %}
{% set x = (position * vb_width)+margin %}
{% set y = (vb_height - value)+margin %}
{% if loop.first %}M{{ x | int }} {{ y | int }}{% else %} L{{ x | int }} {{ y | int }}{% endif %}
{% endfor %}
{% endmacro %}
{% macro circles_with_skipped_points(data_points, color) %} {% macro circles_with_skipped_points(data_points, color) %}
{% for i in range(data_points|length) %} {% for i in range(data_points|length) %}
{% set current_value, current_position = data_points[i] %} {% set current_value, current_position = data_points[i] %}
@@ -72,19 +64,6 @@
</g> </g>
{% endfor %} {% endfor %}
<g style="fill-opacity: 0%">
{% for pos, message in plot_labels %}
{% set x = (pos * vb_width) - (stroke_width/2) + margin %}
{% set y = 0 %}
{% set width = stroke_width %}
{% set height = vb_height + margin %}
<rect x="{{ x | int }}" y="{{ y | int }}" width="{{ width | int }}" height="{{ height | int }}"
class="pnt-{{ unique_id }}" data-msg="{{ message }}"></rect>
{% endfor %}
</g>
<path d="{{ path_best_fit(best_fit_points, vb_height) }}" stroke="gray" stroke-dasharray="2,1" fill="none"
stroke-opacity="60%" />
</svg> </svg>
{% if plots|length > 1 %} {% if plots|length > 1 %}
<div class="flex justify-center pt-2"> <div class="flex justify-center pt-2">