Skip to content

feat(charts): add MultipleColumnRangeAnnotation for multi-panel support#485

Merged
palewire merged 3 commits intochekos:mainfrom
palewire:main
Oct 28, 2025
Merged

feat(charts): add MultipleColumnRangeAnnotation for multi-panel support#485
palewire merged 3 commits intochekos:mainfrom
palewire:main

Conversation

@palewire
Copy link
Copy Markdown
Collaborator

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.

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.
@palewire palewire requested a review from Copilot October 28, 2025 21:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 MultipleColumnRangeAnnotation as a subclass of RangeAnnotation with plot and show_in_all_plots fields
  • Updates MultipleColumnChart serialization and deserialization to use the new annotation type
  • Implements custom serialization to place the plot field inside the position object to match the Datawrapper API format

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread datawrapper/charts/multiple_column.py Outdated
Comment thread datawrapper/charts/multiple_column.py Outdated
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.
@palewire palewire requested a review from Copilot October 28, 2025 23:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_annotations should include MultipleColumnRangeAnnotation like other chart classes include their annotation types. Change to list[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.

@palewire palewire merged commit 33e2f35 into chekos:main Oct 28, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants