Skip to content

Conversation

@valentin-best
Copy link

This PR introduces support for chart items in the document serialization and manipulation framework. The changes add a new ChartItem type, its associated data model, and integrate chart serialization into the existing system for Markdown, HTML, and DocTags formats. Additionally, methods for adding and inserting charts into documents are provided, along with updates to document structure and indexing to accommodate charts.

Chart Item Support

  • Added the ChartItem class and its data model ChartData, enabling charts to be represented as items within documents. Includes methods for exporting charts to Markdown and Pandas DataFrame. [1] [2]
  • Updated the document structure to include a charts list, and extended document indexing and update logic to handle chart items. [1] [2] [3]

Chart Manipulation Methods

  • Added add_chart and insert_chart methods to DoclingDocument for creating and inserting chart items, similar to how tables and pictures are handled. [1] [2]
  • Updated internal item appending logic to support chart items.

Chart Serialization Integration

  • Introduced BaseChartSerializer abstract class and implemented format-specific serializers: MarkdownChartSerializer, HTMLChartSerializer, and DocTagsChartSerializer. These serializers are integrated into the respective document serializers. [1] [2] [3] [4]
  • Registered chart serializers in the document serializer classes for Markdown, HTML, and DocTags, enabling serialization of chart items alongside other document elements. [1] [2] [3]

Type and Import Updates

  • Updated imports and type definitions throughout the codebase to recognize ChartItem and ChartData, ensuring correct type checking and serialization. [1] [2] [3] [4] [5] [6]

Serialization Logic Extension

  • Extended the main serialization logic to handle ChartItem instances, delegating to the appropriate chart serializer based on document format.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 8, 2025

DCO Check Passed

Thanks @valentin-best, all your commits are properly signed off. 🎉

@mergify
Copy link

mergify bot commented Oct 8, 2025

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🔴 Require two reviewer for test updates

This rule is failing.

When test data is updated, we require two reviewers

  • #approved-reviews-by >= 2

🟢 Enforce conventional commit

Wonderful, this rule succeeded.

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

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