Skip to content

Enhancement proposal for Waterfall chart. For #583#778

Open
sanand0 wants to merge 2 commits into
scanny:masterfrom
sanand0:master
Open

Enhancement proposal for Waterfall chart. For #583#778
sanand0 wants to merge 2 commits into
scanny:masterfrom
sanand0:master

Conversation

@sanand0
Copy link
Copy Markdown

@sanand0 sanand0 commented Dec 24, 2021

@scanny I've put together an analysis document for the waterfall chart, as you'd suggested for #583

I based this on the Bubble Chart proposal. This only covers the waterfall chart as an example, but this could be easily extended to cover:

  • boxWhisker
  • clusteredColumn
  • paretoLine
  • sunburst
  • treemap

I'd be happy to support this in any way. Please let me know if you'd like any further analysis or exploration.

Copy link
Copy Markdown
Owner

@scanny scanny left a comment

Choose a reason for hiding this comment

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

@sanand0 this is great work. My initial impression is that this will be a substantial (read "herculian") change. I'd like analysis to consider the full "new-style" chart scope, we don't want to design something that can't be extended to the other chart types, but that can wait until we at least understand one well.

It looks like Microsoft added a new add-chart method (.AddChart2()) to accommodate these. Is that your understanding as well? Do they have an established name (instead of "new-style") by which they distinguish this new family of charts from the legacy ones?

Also let me know your general appetite for proceeding. There's going to be a lot of work here but even getting this far is a valuable contribution because otherwise I'm sure I would never have even explored it.

The columns are color coded so you can quickly tell positive from negative numbers. The initial and
the final value columns often start on the horizontal axis, while the intermediate values are
floating columns. Because of this "look", waterfall charts are also called bridge charts.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This Wikipedia link was something I ended up searching for quickly for orientation: https://en.wikipedia.org/wiki/Waterfall_chart

Probably worth working in early on in intro. All this suddenly started making a lot more sense after spending about 30-seconds there.

<p:clrMapOvr>
<a:masterClrMapping/>
</p:clrMapOvr>
</p:sld>
Copy link
Copy Markdown
Owner

@scanny scanny Dec 24, 2021

Choose a reason for hiding this comment

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

This slide XML is too much. If it's the same as a regular chart let's leave it out, otherwise, focus on the differences. Actually let's leave it in for now, tightening this up isn't the biggest fish to fry at the moment :)

Alternate content generally indicates that older versions of PPT don't provide support and that there are actually two versions of this thing whatever it is. That would be a pretty massive change and definitely the part we'd want to focus on.

I expect I'll come back to this after reading further, but I think an intro paragraph and then just the high-level on the alternates and what they are, something like:

Waterfall charts are not supported by PowerPoint versions prior to {first-supporting-version, both Windows and Mac}. The waterfall chart appears inside an <mc:AlternateContent> block to accommodate non-supporting versions. The supporting alternative is a p:graphicFrame element. The fallback alternative is a p:pic element and represents a static image of the chart ...

Generating a static image rendering of the chart doesn't sound like something we're going to be able to do by the way, so we'll need to continue to think about how we accommodate that.

</p:clrMapOvr>
</p:sld>


Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Let's have a look at the slide relationships too, in particular rId2. I'm not seeing where chartEx1.xml is coming from and that's an unfamiliar root name. Maybe from an example slide that has both a traditional chart and a waterfall chart so we can contrast the two.

<Relationship Id="rId3" Type="http://schemas.microsoft.com/office/2011/relationships/chartColorStyle" Target="colors1.xml"/>
<Relationship Id="rId2" Type="http://schemas.microsoft.com/office/2011/relationships/chartStyle" Target="style1.xml"/>
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/package" Target="../embeddings/Microsoft_Excel_Worksheet.xlsx"/>
</Relationships>
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

maybe also show the _rels/chart1.xml too so we can see how the relationships are affected. I don't remember those including color and style part relationships.

</cx:plotArea>
<cx:legend pos="t" align="ctr" overlay="0" />
</cx:chart>
</cx:chartSpace>
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I think we need a contrast-study on this as well. What specifically is different for a waterfall chart? Minimally those should be catalogued. If a side-by-side is helpful we should have that too. I'm starting to like the idea of the slide being a side-by-side 2-chart slide with the left one being traditional (add that one first) and the second being waterfall. Then the comparison can follow throughout.

This looks different in shape to me, but that could just be a formatting difference.

<a:schemeClr val="tx1"/>
</cs:fontRef>
</cs:wall>
</cs:chartStyle>
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This is too long, let's find a way to summarize, like show a couple styles and then abbreviate the rest.

ActiveChart.Axes(xlCategory).Select
ActiveChart.SetElement (msoElementPrimaryCategoryGridLinesMajor)
ActiveChart.Axes(xlValue).Select
Selection.MajorTickMark = xlOutside
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Let's see a contrast here too. The old one should look pretty much like the existing python-pptx protocol.

@sanand0
Copy link
Copy Markdown
Author

sanand0 commented Dec 25, 2021

Thanks for the comments @scanny. The newer charts are steadily gaining traction, and I'd be happy to work on this. I'll spend the next few days comparing the new charts with the old and revert based on your comments.

@sanand0
Copy link
Copy Markdown
Author

sanand0 commented Jan 5, 2022

@scanny -- I've added a few details, but I thought it might be best to share the full extract of a PPT with a bar chart and a waterfall TEMPORARILY so that you might get a sense of what's happening & is different between these charts.

I'll continue with the analysis, but just wanted to check with you if it's OK to commit a few selected XML files as part of the PR?

@rileym99
Copy link
Copy Markdown

rileym99 commented Feb 5, 2025

Hello,

I am very interested in having the new chart types in python-pptx, as I have created an entire module dedicated to automating our analytics and creating PowerPoint content. Did you ever progress this topic?

Do you think it would be possible to hack together a workaround by my manually creating the xml, and/or creating part of the chart with existing python-pptx methods and then changing the xml tags from c: to cx:? Sorry if this a dumb question - I'm really only a beginner with xmlchemy and have only used it for some simple cases like table borders.

Regards,
Matthew

@srozov
Copy link
Copy Markdown

srozov commented May 30, 2025

Hello, it looks like there's quite some interest from the community to have new chart types support.
Any chance to merge this PR?

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.

4 participants