From 28c4d789cfbb7d5d7201feb7acc2206646f651d4 Mon Sep 17 00:00:00 2001 From: Arnav Angarkar Date: Mon, 10 Nov 2025 00:20:42 +0530 Subject: [PATCH] feat: Add GeoChart visualization for volunteers by region - Add chart_type field to volunteer breakdown data structure - Implement conditional rendering: GeoChart for regions, Bar Chart for others - Update Google Charts loader to include geochart package - Add comprehensive test coverage for chart_type field - Fixes #230 --- portal/common.py | 3 + templates/portal/stats.html | 2 +- templates/volunteer/volunteer_charts.html | 72 +++++++++++++++-------- tests/portal/test_common.py | 41 +++++++++++++ 4 files changed, 92 insertions(+), 26 deletions(-) diff --git a/portal/common.py b/portal/common.py index f532fab4..b85abf5c 100644 --- a/portal/common.py +++ b/portal/common.py @@ -455,6 +455,7 @@ def get_volunteer_breakdown(): "columns": ["Chapter", "Volunteers"], "data": result, "chart_id": "volunteer_by_chapter", + "chart_type": "bar", } ) @@ -471,6 +472,7 @@ def get_volunteer_breakdown(): "columns": ["Region", "Volunteers"], "data": result, "chart_id": "volunteers_by_region", + "chart_type": "geo", } ) @@ -489,6 +491,7 @@ def get_volunteer_breakdown(): "columns": ["Language", "Volunteers"], "data": result, "chart_id": "volunteers_by_languages", + "chart_type": "bar", } ) diff --git a/templates/portal/stats.html b/templates/portal/stats.html index 2b5a5b5f..a6c3d469 100644 --- a/templates/portal/stats.html +++ b/templates/portal/stats.html @@ -6,7 +6,7 @@