diff --git a/templates/partials/svg_line_graph.html b/templates/partials/svg_line_graph.html index 23d5a0b..a72a7c3 100644 --- a/templates/partials/svg_line_graph.html +++ b/templates/partials/svg_line_graph.html @@ -17,7 +17,7 @@ {% endfor %} {% endmacro %} -{% macro circles(data_points, color) %} +{% macro circles_with_skipped_points(data_points, color) %} {% for i in range(data_points|length) %} {% set current_value, current_position = data_points[i] %} {% set prev_value = data_points[i - 1][0] if i > 0 else None %} @@ -31,9 +31,19 @@ {% endfor %} {% endmacro %} +{% macro circles_interactive(data_points) %} + + {% for value, position, message in data_points %} + {% set x = (position * vb_width)+margin %} + {% set y = (vb_height - value)+margin %} + + {% endfor %} + +{% endmacro %} + {% macro plot_line(points, color) %} - {{ circles(points, color) }} + {{ circles_with_skipped_points(points, color) }} {% endmacro %} @@ -58,6 +68,7 @@ {% for plot in plots %} {{ plot_line(plot.points, plot.color) }} + {{ circles_interactive(plot.plot_labels) }} {% endfor %} @@ -75,14 +86,17 @@ -
- {% for plot in plots %} -
-
-
{{ plot.label }}
-
+ {% if plots|length > 1 %} +
+ {% for plot in plots %} +
+
+
{{ plot.label }}
+
{% endfor %} -
+
+ {% endif %} \ No newline at end of file diff --git a/utils.py b/utils.py index 88b43b0..fd4da1e 100644 --- a/utils.py +++ b/utils.py @@ -412,12 +412,15 @@ def get_weekly_pr_graph_model(title, weekly_pr_data): values_scaled = [((value - min_value) / value_range) * vb_height for value in values] plot_points = list(zip(values_scaled, relative_positions)) + messages = [f'{value} for {person_name} at {date.strftime("%d %b %y")}' for value, date in zip(values, pr_counts.keys())] + plot_labels = zip(values_scaled, relative_positions, messages) # Create a plot for each user plot = { 'label': person_name, # Use PersonName instead of User ID 'color': colors[count], - 'points': plot_points + 'points': plot_points, + 'plot_labels': plot_labels } plots.append(plot)