feat(charts): add MultipleColumnRangeAnnotation for multi-panel support#485
Merged
palewire merged 3 commits intochekos:mainfrom Oct 28, 2025
Merged
feat(charts): add MultipleColumnRangeAnnotation for multi-panel support#485palewire merged 3 commits intochekos:mainfrom
palewire merged 3 commits intochekos:mainfrom
Conversation
Add specialized range annotation class for MultipleColumnChart that supports panel-specific annotations. The new MultipleColumnRangeAnnotation extends RangeAnnotation with: - `plot` field to target specific panels (e.g., "Paris", "London") - `show_in_all_plots` flag to control annotation visibility across panels - Custom serialization/deserialization to handle API format where plot is nested in position object and showInAllPlots is at top level Update MultipleColumnChart to use the new annotation class for proper handling of range annotations in multi-panel visualizations.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for multi-panel specific range annotations in MultipleColumnChart by introducing the MultipleColumnRangeAnnotation class. This allows range annotations to be associated with specific plots/panels in multi-panel charts and control whether they appear in all plots.
- Introduces
MultipleColumnRangeAnnotationas a subclass ofRangeAnnotationwithplotandshow_in_all_plotsfields - Updates
MultipleColumnChartserialization and deserialization to use the new annotation type - Implements custom serialization to place the
plotfield inside thepositionobject to match the Datawrapper API format
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Remove support for list format in deserialize_model methods across annotation classes (TextAnnotation, AreaFill, RangeAnnotation). The API consistently returns dict format with UUID keys, making the list format handling unnecessary. This simplifies the code by: - Removing isinstance checks for list format - Updating type hints to only accept dict[str, dict] | None - Streamlining docstrings to reflect single format support - Reducing code complexity while maintaining functionality
Add new MultipleColumnRangeAnnotation class to support range annotations specifically for multiple column charts. This class is now exported from the main datawrapper module and charts submodule, and documentation has been updated to include its parameter table. This addition provides users with a dedicated annotation type for highlighting ranges in multiple column chart visualizations.
Contributor
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
datawrapper/charts/multiple_column.py:408
- The type annotation for
range_annotationsshould includeMultipleColumnRangeAnnotationlike other chart classes include their annotation types. Change tolist[MultipleColumnRangeAnnotation | dict[Any, Any]]for consistency with other charts (e.g., ColumnChart, LineChart) and to provide better type safety.
range_annotations: list[dict[Any, Any]] = Field(
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add specialized range annotation class for MultipleColumnChart that supports panel-specific annotations. The new MultipleColumnRangeAnnotation extends RangeAnnotation with:
plotfield to target specific panels (e.g., "Paris", "London")show_in_all_plotsflag to control annotation visibility across panelsUpdate MultipleColumnChart to use the new annotation class for proper handling of range annotations in multi-panel visualizations.