Skip to content

feat(charts): add comprehensive export options for PNG, PDF, and SVG#518

Merged
palewire merged 1 commit intochekos:mainfrom
palewire:main
Dec 1, 2025
Merged

feat(charts): add comprehensive export options for PNG, PDF, and SVG#518
palewire merged 1 commit intochekos:mainfrom
palewire:main

Conversation

@palewire
Copy link
Collaborator

@palewire palewire commented Dec 1, 2025

Add missing export parameters to align with Datawrapper API capabilities:

  • PNG: add scale, logo, logo_id, dark, ligatures, full_vector, download
  • PDF: add zoom, transparent, logo, logo_id, dark, ligatures, full_vector, download
  • SVG: add zoom, logo, logo_id, dark, ligatures, full_vector, download

Also clarify distinction between scale (size multiplier) and zoom (resolution/DPI multiplier) in docstrings.

Add missing export parameters to align with Datawrapper API capabilities:
- PNG: add scale, logo, logo_id, dark, ligatures, full_vector, download
- PDF: add zoom, transparent, logo, logo_id, dark, ligatures, full_vector, download
- SVG: add zoom, logo, logo_id, dark, ligatures, full_vector, download

Also clarify distinction between scale (size multiplier) and zoom (resolution/DPI multiplier) in docstrings.
@palewire palewire requested a review from Copilot December 1, 2025 20:25
@palewire palewire merged commit 8d52d1c into chekos:main Dec 1, 2025
13 checks passed
Copy link
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 comprehensive export options to align the PNG, PDF, and SVG export methods with Datawrapper API capabilities. The changes enhance all three export methods with additional parameters for customization such as scale/zoom control, logo configuration, dark mode, ligatures, and vector output options.

Key Changes:

  • Added 7 new parameters to export_png: scale, logo, logo_id, dark, ligatures, full_vector, and download
  • Added 8 new parameters to export_pdf: zoom, transparent, logo, logo_id, dark, ligatures, full_vector, and download (plus timeout fix)
  • Added 9 new parameters to export_svg: scale, zoom, transparent, border_width, border_color, logo, logo_id, dark, ligatures, full_vector, and download
  • Clarified docstrings to distinguish between scale (size multiplier) and zoom (resolution/DPI multiplier)
  • Updated integration tests to cover all new parameters

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
datawrapper/charts/base.py Added comprehensive export parameters to PNG, PDF, and SVG export methods with updated docstrings and parameter handling
tests/integration/test_base_export.py Extended integration tests to verify all new export parameters are correctly passed to the API
Comments suppressed due to low confidence (1)

tests/integration/test_base_export.py:52

  • The test test_export_png_with_all_parameters doesn't actually test all newly added PNG export parameters. It's missing tests for scale, logo, logo_id, dark, ligatures, full_vector, and download parameters. Consider adding these parameters to this test or creating a separate comprehensive test that includes all parameters.
    def test_export_png_with_all_parameters(self):
        """Test PNG export with all parameters specified."""

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

height: Height of visualization. If not specified, uses chart height.
plain: If True, exports only the visualization without header/footer.
scale: Size multiplier that changes actual dimensions (e.g., 2 = 2x size).
zoom: Resolution multiplier for sharper output at same visual size (e.g., 2 = 2x DPI).
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

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

The description of zoom for SVG export may be misleading. SVG is a vector format that doesn't have DPI (dots per inch) since it's resolution-independent. Consider revising the description to clarify how zoom applies to SVG format, or mention that it primarily affects rasterization when the SVG is converted.

Suggested change
zoom: Resolution multiplier for sharper output at same visual size (e.g., 2 = 2x DPI).
zoom: Scale multiplier for rendering. For SVG (a vector format), this affects the scale at which the SVG is rendered or rasterized (e.g., when converting to PNG). It does not affect intrinsic resolution or DPI.

Copilot uses AI. Check for mistakes.
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.

1 participant