From 1f4f66b7a69dd3a96da60f410929640a66e0cc68 Mon Sep 17 00:00:00 2001 From: palewire Date: Tue, 28 Oct 2025 16:45:19 -0400 Subject: [PATCH] feat(charts): change default value labels display to 'off' for MultipleColumnChart Changed the default value for `show_value_labels` from "hover" to "off" in MultipleColumnChart to better align with common use cases where value labels are not needed by default. Also updated the documentation example to: - Fix the Datawrapper documentation URL to point to the academy article - Simplify the example description - Replace text annotation with a horizontal line range annotation - Remove the "2025" text label while keeping the projection period highlighting These changes make the example cleaner and demonstrate different annotation types more effectively. --- datawrapper/charts/multiple_column.py | 2 +- .../charts/multiple-column-charts.md | 23 +++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/datawrapper/charts/multiple_column.py b/datawrapper/charts/multiple_column.py index 3a7fb76..cd6b407 100644 --- a/datawrapper/charts/multiple_column.py +++ b/datawrapper/charts/multiple_column.py @@ -277,7 +277,7 @@ def validate_plot_height_mode(cls, v: PlotHeightMode | str) -> PlotHeightMode | #: Whether or not to show value labels show_value_labels: ValueLabelDisplay | str = Field( - default="hover", + default="off", alias="show-value-labels", description="Whether or not to show value labels", ) diff --git a/docs/user-guide/charts/multiple-column-charts.md b/docs/user-guide/charts/multiple-column-charts.md index 25445b7..1877f34 100644 --- a/docs/user-guide/charts/multiple-column-charts.md +++ b/docs/user-guide/charts/multiple-column-charts.md @@ -1,6 +1,6 @@ # MultipleColumnChart -This example, drawn from [Datawrapper's official documentation](https://www.datawrapper.de/charts/multiple-columns), demonstrates how to create small multiple column charts showing population growth in major cities from 1950 to 2035. The chart features custom panel titles with country information, highlighted data for 2025, a range annotation to mark the projection period and a 4-column grid layout. +This example, drawn from [Datawrapper's official documentation](https://academy.datawrapper.de/article/405-examples-of-datawrapper-multiple-column-charts), demonstrates how to create small multiple column charts showing population growth in major cities from 1950 to 2035. @@ -52,17 +52,7 @@ chart = dw.MultipleColumnChart( {"column": "New York-Newark", "title": "New York/Newark, U.S."}, ], # Add text annotation to label the projection period - text_annotations=[ - { - "text": "2025", - "x": "2023/01/01", - "y": 30000000, - "align": "tc", - "color": "#b73229", - "size": 14, - "bold": True, - }, - ], + text_annotations=[], # Add range annotation to highlight projection period range_annotations=[ { @@ -74,6 +64,15 @@ chart = dw.MultipleColumnChart( "color": "#888", "opacity": 18, }, + { + "type": "y", + "y0": 11765087.7143, + "display": "line", + "color": "#888", + "opacity": 76, + "stroke_width": dw.StrokeWidth.MEDIUM, + "stroke_type": "dotted", + } ], )