Repository navigation
feat(pptx): read every plot of a combination chart - #4773
Conversation
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>
|
✅ DCO Check Passed Thanks @DanielNg0729, all your commits are properly signed off. 🎉 |
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
AI triage (advisory)Checked commit 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: CI safety: no concern found. A maintainer must still approve CI. 3 related pull request(s) in the same code
The |
There was a problem hiding this comment.
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.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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:
chart.chart_typegives the type of the back-most plot only. Thepicture was classified as
bar_chart, and the line plot was not visible.40909.0), not as dates.was always empty.
of a "Volume-High-Low-Close" chart.
list(chart.plots)then raised, and thewhole chart lost its data table, also the series of the readable plots.
This PR changes the PowerPoint backend only.
get_main_prediction()(Markdown, HTML, DocTags, DocLang) therefore do not change. A single-plot chart still gets one prediction.other_chart. Its series are skipped with a warning, and the series of the other plots stay in the table.c:axId.chart.category_axisis not used, because it returns the firstc:catAxeven when the plot uses ac:dateAx, so it can pick the hidden axis of the secondary plot. The 1904 date system is supported.Checklist: