Refactor svg render logic (minor)
This commit is contained in:
11
utils.py
11
utils.py
@@ -396,10 +396,11 @@ def get_weekly_pr_graph_model(title, weekly_pr_data):
|
||||
relative_positions = [(date - min_date).days / total_span for date in all_dates]
|
||||
|
||||
# Calculate viewBox dimensions
|
||||
max_pr_count = max(max(user_data["PRCounts"].values()) for user_data in weekly_pr_data.values()) or 1
|
||||
vb_width, vb_height = total_span, max_pr_count
|
||||
vb_width *= 200 / vb_width # Scale to 200px width
|
||||
vb_height *= 75 / vb_height # Scale to 75px height
|
||||
max_value = max(max(user_data["PRCounts"].values()) for user_data in weekly_pr_data.values()) or 1
|
||||
min_value = 0
|
||||
value_range = max_value - min_value
|
||||
vb_width = 200
|
||||
vb_height= 75
|
||||
|
||||
plots = []
|
||||
colors = get_distinct_colors(len(weekly_pr_data.items()))
|
||||
@@ -408,8 +409,6 @@ def get_weekly_pr_graph_model(title, weekly_pr_data):
|
||||
person_name = user_data["PersonName"]
|
||||
|
||||
values = pr_counts.values()
|
||||
min_value, max_value = min(values), max(values)
|
||||
value_range = (max_value - min_value) or 1
|
||||
|
||||
values_scaled = [((value - min_value) / value_range) * vb_height for value in values]
|
||||
plot_points = list(zip(values_scaled, relative_positions))
|
||||
|
||||
Reference in New Issue
Block a user