Skip to content

Conversation

@tmustier
Copy link
Owner

Summary

Adds chart cell support — embed native PowerPoint bar charts directly in table cells via YAML references. Also introduces the sub field for semantic header subtitles and fixes column sizing for chart-heavy tables.

Chart Cells

Table cells can now reference chart data points using chartname-N syntax:

charts:
  revenue:
    dir: vertical
    values: [100, 200, 300]
    format: "{:.0f}"
    color: "#0D193B"

table:
  cells:
    - [revenue-1, revenue-2, revenue-3]

Each chart reference renders as a native <c:chartSpace> shape sized to the cell. Supports:

  • Vertical and horizontal bar charts
  • Scale groups — charts sharing a scale group use the same axis max for visual comparability
  • Data labels — positioned outside bars with per-label x-offsets (horizontal) or headroom (vertical)
  • Format strings — Python format specs (e.g. "{:.1f}x", "€{}m") converted to Excel number formats
  • Charts delegate to an external generator module (CLEAN_SLIDES_CHARTS_PATH env var or charts.py in the project)

Header sub Field

New optional sub field on all header types for units, qualifiers, and annotations:

col_superheaders:
  - { label: "Net Debt / EBITDAaL", sub: "Ratio", span: 2 }

col_headers:
  - { text: "Interest paid", sub: "€m" }
  - "FY26E"
  - { text: "IRR", sub: "%" }

row_header_col_header: { text: "Net debt", sub: "€m" }

row_headers:
  - { text: "€6,000m", sub: "Base Case" }

The sub text renders as a soft line break (<a:br/>) within the same paragraph — non-bold, body text color, no extra paragraph spacing. Plain strings still work unchanged.

Column Sizing Fix

Chart-only columns no longer claim an equal share of the area as their max width. They use their header text width instead, expanding proportionally with remaining slack. This prevents text-only columns from being squeezed when many chart columns are present.

Changes

  • clean_slides/spec.pyChartDef, ChartRef dataclasses; sub field on ColSuperHeader and TableSpec headers; rich content parsing for headers
  • clean_slides/chart_render.py — new module: chart shape generation, label positioning, scale groups
  • clean_slides/charts.py — chart module loader
  • clean_slides/content.pyheader_text_and_sub() helper; _make_sub_paragraph(); sub on Paragraph
  • clean_slides/renderer.py — chart cell rendering; use_line_breaks=True for header cells
  • clean_slides/sizing.py — chart row/column equalization; sub-aware height/width calculations; responsive chart column sizing
  • clean_slides/verification.py — pass raw header values (not stringified) to overflow checks
  • Tests added for chart cell parsing and rendering

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2f76d9e69c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Add support for embedding native bar charts directly in table cells.

- add ChartDef/ChartRef parsing and chart-ref validation in CLI checks
- render chart groups via chart_render.py using charts.py integration
- teach sizing to ignore chart refs for text measurement and align chart spans
- refine label layout/formatting (direction-aware plot area, nowrap, offsets)
- extend tests for parsing, sizing, and end-to-end chart-cell generation
Allow structured header content in table specs and render subtitles consistently.

- support rich objects for col_headers, row_header_col_header, and col_superheaders
- add `sub` header field parsing for units/qualifiers
- render subtitle text using line breaks for compact header layout
- update sizing and verification logic for rich and plain header inputs
Introduce waterfall chart rendering for chart-cell groups.

- extend chart spec parsing with waterfall options (totals, decreases, connectors)
- add waterfall payload generation and rendering in chart_render.py
- use overlay value labels/connectors for precise in-cell layout control
- hide the axis line in cell waterfall styles for cleaner presentation
Address follow-up issues identified during review and CI.

- equalize vertical chart span columns across all ColumnSizer sizing modes
- preserve explicit `{:.0f}` formatting as Excel `0` (not `General`)
- add regression tests for chart-column equalization and zero-decimal formatting
- apply Ruff/Black/pre-commit cleanups required for a green lint job
@tmustier tmustier merged commit bcb4259 into main Feb 11, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant