Skip to content

[Epic] Modern Charts via cx: Namespace — waterfall, funnel, treemap, sunburst, box-plot, histogram #14

@MHoroszowski

Description

@MHoroszowski

Problem

Office 2016 introduced a new chart family — Waterfall, Funnel, Treemap, Sunburst, Box-Plot, and Histogram — under a separate XML namespace cx: (http://schemas.microsoft.com/office/drawing/2014/chartex). These do not live inside the <c:chartSpace> tree that python-pptx writes; they live in <cx:chartSpace> and ship as a different Content-Type (application/vnd.ms-office.chartex+xml). python-pptx today has zero cx: support — there is no XL_CHART_TYPE enum entry for any of these, and no writer path. Demand is real (scanny/python-pptx#583, #778, #479, #651, #305, #371, #386, #944, #1047) and there is a publishable fork (GetThematic/python-pptx) that already implements a clean waterfall path on top of the existing 1.0 codebase.

Sub-features

  • Add cx: namespace XML element classes mirroring the existing c: lineage
  • New content-type application/vnd.ms-office.chartex+xml registration in opc/constants.py
  • XL_CHART_TYPE enum extended with WATERFALL, FUNNEL, TREEMAP, SUNBURST, BOX_PLOT, HISTOGRAM_PARETO, HISTOGRAM
  • Slide.shapes.add_chart(XL_CHART_TYPE.WATERFALL, x, y, cx, cy, chart_data) dispatches to cx: writer
  • At minimum: round-trip preservation (read deck containing waterfall → save → no corruption)
  • Writer support for at least 3 of the 6 types: Waterfall (highest demand), Treemap, Sunburst
  • Data-replacement API parallel to existing Chart.replace_data(...) for cx: charts
  • Phased delivery: Phase A round-trip preservation only; Phase B writer for Waterfall; Phase C remaining types

Prior art

  • Open PRs: scanny/python-pptx#778 Waterfall enhancement (sanand0, 10k LOC includes RFC + impl — read for design ideas, do not merge wholesale).
  • Forks:
  • User issues this would close: scanny/python-pptx#235, #266, #305, #371, #386, #479, #583, #651, #719, #944, #1047, #1101.
  • OOXML: ECMA-376 5th ed. Part 4 — Chart Extensibility (cx:). Top-level <cx:chartSpace> with <cx:chartData>, <cx:plotArea>, <cx:plotAreaRegion>. Per-type elements: <cx:treemap>, <cx:sunburst>, <cx:waterfall>, <cx:funnel>, <cx:boxWhisker>, <cx:clusteredColumn> (used for Histograms with cx:binning).
  • Code paths: new src/pptx/chart/cx_chart.py, new src/pptx/oxml/chart/cx_*.py, extend src/pptx/enum/chart.py, extend src/pptx/parts/chart.py, register content-type in src/pptx/opc/constants.py.

Acceptance criteria

  • A user can call slide.shapes.add_chart(XL_CHART_TYPE.WATERFALL, ...) and PowerPoint opens the resulting deck with a real Waterfall chart (not a corruption banner, not a placeholder).
  • A pptx that ALREADY contains a Waterfall (authored in PowerPoint) reads, modifies one unrelated slide, and saves without corrupting the Waterfall.
  • 30+ behave scenarios across the implemented cx: types.
  • Documentation page for cx: charts in docs/user/charts.rst.

Effort: L

Big surface; the cx: family is essentially a parallel chart writer. Strongly recommend phased delivery and start by cherry-picking GetThematic/python-pptx Waterfall as Phase A.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:chartsFeature area: chartsepicMulti-feature roadmap epicprior-art:forkActive community fork has shipped thisprior-art:upstream-prOpen PR on scanny/python-pptx is candidate cherry-pickpriority:P1Important but not urgent

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions