From 06844fa5b09641c5cff2c09ae62b2340e6d001c9 Mon Sep 17 00:00:00 2001 From: Peter Stockings Date: Sat, 9 Dec 2023 21:25:48 +1100 Subject: [PATCH] In svg graph convert all numeric attributes to integers to reduce size, 13.9KB - 12.6KB --- templates/partials/sparkline.html | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/templates/partials/sparkline.html b/templates/partials/sparkline.html index 5563260..45053ec 100644 --- a/templates/partials/sparkline.html +++ b/templates/partials/sparkline.html @@ -1,12 +1,11 @@ {% set stroke_width = 4 %} {% set margin = 2 %} -{% set precision = 1 %} {% macro path(data_points, vb_height) %} {% for value, position, message in data_points %} {% set x = (position * vb_width)+margin %} {% set y = (vb_height - value)+margin %} - {% if loop.first %}M{{ x | round(precision) }} {{ y | round(precision) }}{% else %} L{{ x | round(precision) }} {{ y | round(precision) }}{% endif %} + {% if loop.first %}M{{ x | int }} {{ y | int }}{% else %} L{{ x | int }} {{ y | int }}{% endif %} {% endfor %} {% endmacro %} @@ -14,7 +13,7 @@ {% for value, position in best_fit_points %} {% set x = (position * vb_width)+margin %} {% set y = (vb_height - value)+margin %} - {% if loop.first %}M{{ x | round(precision) }} {{ y | round(precision) }}{% else %} L{{ x | round(precision) }} {{ y | round(precision) }}{% endif %} + {% if loop.first %}M{{ x | int }} {{ y | int }}{% else %} L{{ x | int }} {{ y | int }}{% endif %} {% endfor %} {% endmacro %} @@ -22,7 +21,7 @@ {% for value, position, message in data_points %} {% set x = (position * vb_width)+margin %} {% set y = (vb_height - value)+margin %} - + {% endfor %} {% endmacro %} @@ -48,7 +47,7 @@

{{ exercise_name }}

- + {% for plot in plots %} @@ -62,10 +61,10 @@ {% set width = stroke_width %} {% set height = vb_height + margin %}