Problem
Charts in python-pptx assume one plot per chart and one value-axis pair per chart. PowerPoint's most-asked chart capability — combining a bar series with a line series on the same chart, optionally with a secondary axis on the right side — is therefore unreachable through the public API. scanny/python-pptx#141 (multiple axes, 31 comments) and scanny/python-pptx#338 (combo chart, 29 comments) are both top-five-by-engagement on the upstream tracker. Underlying this, chart polish is thin: data-label borders (#716, 17c) cannot be drawn, theme/Accent colors leak (#529, #516), per-point number formatting and per-point invertIfNegative are missing, and there is no Theme object that surfaces the master color/font scheme — meaning charts cannot color-match their host deck programmatically.
Sub-features
Prior art
- Open PRs: scanny/python-pptx#1100 chart categories+SmartArt parsing (SergeevAI, 1168 LOC, 22 files — review carefully for
chart/ regressions). scanny/python-pptx#353 transparency on chart fills. scanny/python-pptx#350 firstSliceAng. scanny/python-pptx#1086 chart label/legend roundtrip tests. scanny/python-pptx#1057 add_chart typing fix.
- Forks:
Martin005/python-pptx-ng — port pptx/theme.py + pptx/oxml/theme.py for Theme object scaffolding (cherry-pick candidate; rest of ng is duplicate of shipped work).
- User issues this would close: scanny/python-pptx#115, #141, #199, #239, #243, #298, #303, #308, #338, #347, #357, #420, #470, #472, #473, #490, #504, #516, #529, #540, #560, #571, #634, #650, #662, #666, #695, #707, #716, #776, #789, #803, #833, #877, #886, #984, #1024, #1025, #1043, #1068.
- OOXML: DrawingML-Chart §21.2.2
<c:plotArea> (multiple plot children), §21.2.2.32 <c:valAx> with crossAx linkage, §21.2.2.33 <c:dLbl> + <c:spPr> for label borders. Theme: §20.1.6 <a:theme> with <a:clrScheme> + <a:fontScheme>.
- Code paths:
src/pptx/chart/, src/pptx/oxml/chart/, new src/pptx/theme.py.
Acceptance criteria
- Combo bar+line chart with secondary axis renders correctly in PowerPoint.
Presentation.theme.color_scheme.accent1 returns the <a:srgbClr> value from theme1.xml.
- Charts authored with theme-color references survive round-trip without losing the reference.
- Data-label borders are visible after PPT reopen.
- Existing 50+ chart unit tests continue passing.
Effort: L
Big surface; phase delivery — Phase A combo+secondary axis, Phase B Theme object, Phase C polish (data-label borders, per-point format).
Problem
Charts in python-pptx assume one plot per chart and one value-axis pair per chart. PowerPoint's most-asked chart capability — combining a bar series with a line series on the same chart, optionally with a secondary axis on the right side — is therefore unreachable through the public API. scanny/python-pptx#141 (multiple axes, 31 comments) and scanny/python-pptx#338 (combo chart, 29 comments) are both top-five-by-engagement on the upstream tracker. Underlying this, chart polish is thin: data-label borders (#716, 17c) cannot be drawn, theme/Accent colors leak (#529, #516), per-point number formatting and per-point invertIfNegative are missing, and there is no
Themeobject that surfaces the master color/font scheme — meaning charts cannot color-match their host deck programmatically.Sub-features
<c:plotArea>children (e.g.<c:barChart>+<c:lineChart>) in one chart; exposeChart.plotsas a real collectionSeries.use_secondary_axis = TrueplusChart.secondary_value_axis/Chart.secondary_category_axisChart.value_axes/category_axescollections (replacing the singularvalue_axis/category_axisproperties)DataLabel.format.linereturning a realLineFormatDataLabel.number_format, per-pointSeries.invert_if_negativeChart.update_cached_values()— push current Excel-cached values back to<c:cache>(closes scanny/python-pptx#115)Chart.apply_template()— apply a*.crtxtemplate to an existing chart (closes scanny/python-pptx#243)Themeobject surface:Presentation.themeexposingcolor_scheme(Accent1..6, Background1/2, Text1/2) andfont_scheme(Latin major/minor, EastAsian, ComplexScript). Resolves theme-color leaks.firstSliceAngand pie color-per-point (scanny/python-pptx#350, #357)Prior art
chart/regressions). scanny/python-pptx#353 transparency on chart fills. scanny/python-pptx#350 firstSliceAng. scanny/python-pptx#1086 chart label/legend roundtrip tests. scanny/python-pptx#1057add_charttyping fix.Martin005/python-pptx-ng— portpptx/theme.py+pptx/oxml/theme.pyfor Theme object scaffolding (cherry-pick candidate; rest of ng is duplicate of shipped work).<c:plotArea>(multiple plot children), §21.2.2.32<c:valAx>withcrossAxlinkage, §21.2.2.33<c:dLbl>+<c:spPr>for label borders. Theme: §20.1.6<a:theme>with<a:clrScheme>+<a:fontScheme>.src/pptx/chart/,src/pptx/oxml/chart/, newsrc/pptx/theme.py.Acceptance criteria
Presentation.theme.color_scheme.accent1returns the<a:srgbClr>value fromtheme1.xml.Effort: L
Big surface; phase delivery — Phase A combo+secondary axis, Phase B Theme object, Phase C polish (data-label borders, per-point format).