Skip to content

feat(pptx): read every plot of a combination chart - #4773

Merged
PeterStaar-IBM merged 5 commits into
docling-project:mainfrom
DanielNg0729:feat/pptx-combo-charts
Oct 12, 2026
Merged

PeterStaar-IBM merged 5 commits into
docling-project:mainfrom
DanielNg0729:feat/pptx-combo-charts

Conversation

@DanielNg0729

Copy link
Copy Markdown
Member

Issue resolved by this Pull Request:
Resolves #4772

Summary

A PowerPoint combination chart has one plot per chart type, for example clustered columns on the primary axis and lines on a secondary axis. The PowerPoint backend read such a chart as if it had one plot:

  • python-pptx's chart.chart_type gives the type of the back-most plot only. The
    picture was classified as bar_chart, and the line plot was not visible.
  • Date categories came out as Excel serial numbers (40909.0), not as dates.
  • The title of the category axis was lost. The top-left cell of the data table
    was always empty.
  • python-pptx has no plot class for some plot types, for example the stock plot
    of a "Volume-High-Low-Close" chart. list(chart.plots) then raised, and the
    whole chart lost its data table, also the series of the readable plots.

This PR changes the PowerPoint backend only.

  • The backend reads the plots one by one. The picture gets one classification prediction per plot type, in drawing order. The back-most plot still gives the main prediction. Serializers that read only get_main_prediction() (Markdown, HTML, DocTags, DocLang) therefore do not change. A single-plot chart still gets one prediction.
  • A plot that python-pptx cannot read counts as other_chart. Its series are skipped with a warning, and the series of the other plots stay in the table.
  • Categories are written as ISO 8601 dates when the axis shows them as dates: a date axis, or a text axis whose number format is a date format. The axis is found by its c:axId. chart.category_axis is not used, because it returns the first c:catAx even when the plot uses a c:dateAx, so it can pick the hidden axis of the secondary plot. The 1904 date system is supported.
  • The category axis title fills the top-left cell of the table. A title linked to a cell is read from the cell cache.

Checklist:

  • Documentation has been updated, if necessary.
  • Examples have been added, if necessary.
  • Tests have been added, if necessary.

Move the table layout, trimming and cell cap out of _chart_to_table_data
into the module function _build_chart_table. The reader now only collects
the categories and the series of a chart. The output does not change.

The stub tests call the builder with plain lists, so they no longer need a
backend instance or stub chart objects.

Signed-off-by: Daniel Nguyen <danielnguyenh07@gmail.com>
A combination chart, such as columns with a line on a secondary axis, has
one plot per chart type. python-pptx reports the type of the back-most plot
only, so the picture was classified as a bar chart and the line plot was not
visible.

Read the plots one by one. The picture now gets one classification
prediction per plot type, in drawing order. The back-most plot still gives
the main prediction, so serializers that read only the main prediction do
not change. A single-plot chart still gets one prediction.

python-pptx has no plot class for some plot types, for example a stock
plot. Before, such a plot made the whole chart lose its data table. Now
that plot counts as other_chart, its series are skipped with a warning,
and the series of the other plots stay in the table.

Signed-off-by: Daniel Nguyen <danielnguyenh07@gmail.com>
A chart caches date categories as Excel serial numbers, so the data table
showed 40909.0 where the slide shows 'Jan 1, 12'.

Find the category axis of the plot that gives the categories by its c:axId.
chart.category_axis is not used, because it returns the first c:catAx even
when the plot uses a c:dateAx, so it can pick the hidden axis of a
secondary plot. The categories are dates when the axis is a date axis, or
when the number format that the axis shows is a date format. Dates are
written as ISO 8601 (2012-01-01), in the 1900 or the 1904 date system of
the chart. Text categories and numbers that are not shown as dates do not
change.

Signed-off-by: Daniel Nguyen <danielnguyenh07@gmail.com>
The top-left cell of a chart's data table was always empty, and the title
of the category axis was lost. Put that title in the cell, above the
category column it describes.

The title is read from the XML, because python-pptx's axis_title adds a
title element to an axis without one. A title linked to a cell is read from
the cell cache. The value axis titles have no column to head, so they stay
out of the table.

Signed-off-by: Daniel Nguyen <danielnguyenh07@gmail.com>
Add a PowerPoint charts section to the advanced options. It describes the
classified picture and its data table, the category axis title, the ISO
dates, the one prediction per chart type of a combination chart, and the
opt-in chart images.

Signed-off-by: Daniel Nguyen <danielnguyenh07@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

✅ DCO Check Passed

Thanks @DanielNg0729, all your commits are properly signed off. 🎉

@mergify

mergify Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 Merge protection satisfied — ready to merge.

Show 1 satisfied protection

🟢 Enforce conventional commit

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)(?:\(.+\))?(!)?:

@github-actions github-actions Bot added ai:ci-safe AI triage found no CI-safety concern (advisory) enhancement New feature or request pptx issue related to pptx backend table structure labels Oct 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

AI triage (advisory)

Checked commit f70897af18. The analysis read the diff only. It did not run code from this pull request.

The PR extends the PPTX backend to read every plot of a combination chart: each plot type produces one classification prediction, date categories convert to ISO 8601, the category axis title fills the top-left header cell, and unreadable plot types (e.g. stock charts) are skipped with a warning instead of dropping all data.

Topic labels added: enhancement, pptx, table structure.

CI safety: no concern found. A maintainer must still approve CI.

3 related pull request(s) in the same code
PR State Signal Assessment
#4443 open changes the same code related: PR 4443 adds run-level formatting and hyperlinks to the PPTX text backend; it touches overlapping code in mspowerpoint_backend.py but solves a different problem and neither PR subsumes the other.
#3791 open changes the same code related: PR 3791 refactors docling-core import paths in the same files; it does not touch chart logic and does not duplicate this feature.
#4752 open changes the same code related: PR 4752 adds video and audio media handling to the PPTX picture path; it shares mspowerpoint_backend.py but addresses a different shape type and does not overlap with combination-chart logic.

The ai:* labels are advisory. They do not approve CI and they do not add tests:full. A new push runs this check again.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI first review (advisory): no blocker found

This review covers the full diff at f70897af18. It read the code and did not run it.

The pull request adds support for combination charts in the PowerPoint backend by reading each plot, converting date categories to ISO 8601, and preserving category axis titles. The reviewer should verify that using the back-most plot for the primary classification prediction matches the expected output across all downstream serializers.

A maintainer makes the merge decision. This review never approves the pull request.

@github-actions github-actions Bot added the ai:review-lgtm AI first review found no blocker or major issue (advisory) label Oct 12, 2026
@codecov

codecov Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.60305% with 11 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
docling/backend/mspowerpoint_backend.py 91.60% 7 Missing and 4 partials ⚠️

📢 Thoughts on this report? Let us know!

@PeterStaar-IBM PeterStaar-IBM left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm!

@PeterStaar-IBM
PeterStaar-IBM merged commit 070a6d3 into docling-project:main Oct 12, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai:ci-safe AI triage found no CI-safety concern (advisory) ai:review-lgtm AI first review found no blocker or major issue (advisory) enhancement New feature or request pptx issue related to pptx backend table structure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PPTX: a combination chart (columns + line on a secondary axis) is read as a single bar chart

2 participants