invert_if_negative only shows negative bars with white color
So i'm trying to set a red color to negative bars (positives in blue). With this code:
point = plot.series[0].points[i]
fill = point.format.fill
fill.solid()
fill.fore_color.rgb = RGBColor(243, 93, 93)
But the negatives bars show in white.
If I use invert_if_negative = False, then powerpoint shows the bar white and the checkbox unchecked, then I need to check and uncheck to show the proper color.
If I use invert_if_negative = True, then the bar is white again but with the checkbox checked, then I need to uncheck to show the proper color.
What version are you running? I believe this was fixed about a month ago, so make sure you have the very latest version, v0.6.18 I believe.
You are right, i was using a merged version between i think v0.6.17 and the jbq/python-pptx fork. I tried with a clean v0.6.18 and it worked properly, thank you.
What version are you running? I believe this was fixed about a month ago, so make sure you have the very latest version, v0.6.18 I believe.
I have same problem with v0.6.21. Totally same problem.
What version are you running? I believe this was fixed about a month ago, so make sure you have the very latest version, v0.6.18 I believe.
I have same problem with v0.6.21. Totally same problem.
I used v0.6.18 and tried again, the problem still remains. I think the problem might be related to the version of PowerPoint. I'm using Microsoft365 as my program, don't know if it's related to this problem.
The problem is related to the fact that this option exists on both - series and each individual data point. python-pptx only supports to set the global option on the serie but not on each point. If you check and uncheck the option in power point, it will also uncheck the option for all points in the series - hence it will color each point correctly.
You can workaround by adding the option for each point manually
from pptx.oxml.xmlchemy import OxmlElement
def SubElement(parent, tagname, **kwargs):
element = OxmlElement(tagname)
element.attrib.update(kwargs)
parent.append(element)
return element
point = plot.series[0].points[i]
_ = SubElement(point.format.element, 'c:invertIfNegative', val=str(0))