fix(pptx): preserve data points for scatter and bubble charts - #2264
Open
MeiSiristhebest wants to merge 1 commit into
Open
fix(pptx): preserve data points for scatter and bubble charts#2264MeiSiristhebest wants to merge 1 commit into
MeiSiristhebest wants to merge 1 commit into
Conversation
Scatter and bubble charts have no category axis, so chart.plots[0].categories is empty. _convert_chart_to_markdown iterated over categories and therefore emitted zero data rows, silently dropping the entire series. Detect XY/bubble chart types and render rows point-by-point using each point's X value (and bubble size) instead of a category label. Category charts keep their original behavior.
Author
@microsoft-github-policy-service agree |
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.
Summary
markitdownsilently dropped all data when converting PPTX scatter and bubble charts to Markdown.Root cause
_convert_chart_to_markdownbuilds the Markdown table by iterating overchart.plots[0].categories. Scatter/bubble charts have no category axis, socategoriesis empty and the row loop ran zero times — only the header was emitted and every data point was lost.Fix
Detect XY/bubble chart types via
XL_CHART_TYPEand render rows point-by-point instead of row-by-category:c:xValelement (python-pptx only exposes the Y values publicly viaseries.values)."(size)"column per series shows the bubble size.Category charts (column, bar, line, pie, doughnut, radar, area, …) keep their original behavior unchanged. The O(n^2)→O(n) materialization of
series.valuesis preserved.Testing
Added
packages/markitdown/tests/test_pptx_chart.py, which builds in-memory scatter and bubble charts and asserts the data points (and bubble sizes) appear in the converted Markdown. Both new tests pass and the existingtest_pptx_svg.pystill passes. Verified locally withpytestandblack.Fixes the data-loss behavior when converting real-world scatter/bubble charts.