Skip to content

Fix PPTX charts: preserve hierarchical (parent) category labels - #2659

Open
Wu Shuwen (dajiaohuang) wants to merge 1 commit into
microsoft:mainfrom
dajiaohuang:fix/pptx-chart-hierarchical-categories
Open

Wu Shuwen (dajiaohuang) wants to merge 1 commit into
microsoft:mainfrom
dajiaohuang:fix/pptx-chart-hierarchical-categories

Conversation

@dajiaohuang

Copy link
Copy Markdown

Fixes #2502.

python-pptx exposes multi-level category paths via Categories.flattened_labels as tuples (e.g. ('2024', 'Q1'), ('2025', 'Q1')), but PptxConverter was only reading the leaf label via c.label, dropping parent labels entirely so a year/quarter chart produced two identical 'Q1' rows.

Use flattened_labels to render each level of the category hierarchy as its own column (Category (L1), Category (L2), ...). Single-level (flat) category charts are unchanged (single Category column). Also keeps the None→empty-cell fix for missing data points.

Fixes microsoft#2502.

python-pptx exposes multi-level category paths via Categories.flattened_labels
as tuples (e.g. ('2024', 'Q1'), ('2025', 'Q1')), but PptxConverter was only
reading the leaf label via c.label, dropping parent labels entirely so a
year/quarter chart produced two identical 'Q1' rows.

Use flattened_labels to render each level of the category hierarchy as its
own column. Single-level (flat) category charts are unchanged. Also keep the
None->empty-cell fix from microsoft#2526.
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.

PPTX chart conversion drops parent category labels

1 participant