From 2c3543b3ad783bfb31f584e55a637c0a230878e1 Mon Sep 17 00:00:00 2001 From: Michael Barton Date: Thu, 9 Jan 2025 14:15:21 +0000 Subject: [PATCH] Fix waffle plots --- project/npda/views/dashboard/partials.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/project/npda/views/dashboard/partials.py b/project/npda/views/dashboard/partials.py index 0fa00cf4..4d02da68 100644 --- a/project/npda/views/dashboard/partials.py +++ b/project/npda/views/dashboard/partials.py @@ -175,7 +175,7 @@ def get_waffle_chart_partial(request): chart_data = [] # For each label, add the appropriate number of squares to the chart data - for idx, (label, num_squares) in enumerate(data): + for idx, (label, num_squares) in enumerate(data.items()): # For each square, append its data as current r,c, and colour for _ in range(num_squares): square_data = { @@ -216,7 +216,7 @@ def get_waffle_chart_partial(request): ) # Add legend - for idx, (label, pct) in enumerate(data): + for idx, (label, pct) in enumerate(data.items()): fig.add_trace( go.Scatter( x=[None],