diff --git a/scipost_django/graphs/graphs/plotkind.py b/scipost_django/graphs/graphs/plotkind.py index d90c37b84cf37be06a516a30c9a294e10ac314f7..17d0bf4d1555c9881f6b9a24618589aec64aa75d 100644 --- a/scipost_django/graphs/graphs/plotkind.py +++ b/scipost_django/graphs/graphs/plotkind.py @@ -466,7 +466,16 @@ class BarPlot(PlotKind): if qs.exists(): groups, vals = zip(*qs.values_list(group_key, "agg")) - return [str(group) for group in groups], vals + + # Attempt to convert the group values to display labels if possible + try: + field_choices = self.plotter.model._meta.get_field(group_key).choices + group_display_labels = dict(field_choices) + groups = [group_display_labels.get(group, group) for group in groups] + except Exception: + groups = [str(group) for group in groups] + + return groups, vals else: return [], []