Chart - InvertIfNegative

Can be set on a bar series or on a data point. It’s not clear what its meaning is on a non-bar data point. c:barSer/c:invertIfNegative is the target element. Also valid on a bubble series.

Protocol

>>> assert isinstance(plot, pptx.chart.plot.BarPlot)
>>> series = plot.series[0]
>>> series
<pptx.chart.series.BarSeries instance at 0x1deadbeef>
>>> series.invert_if_negative
True
>>> series.invert_if_negative = False
>>> series.invert_if_negative
False

Semantics

  • Defaults to True if the <c:invertIfNegative> element is not present.

  • Defaults to True if the parent element is present but the val attribute is not.

PowerPoint® behavior

In my tests, the <c:invertIfNegative> element is always present in a new bar chart and always explicitly initialized to False.

XML specimens

A series element from a simple column chart (single series):

<c:ser>
  <c:idx val="0"/>
  <c:order val="0"/>
  <c:tx>
    <!-- ... -->
  </c:tx>
  <c:invertIfNegative val="0"/>
  <c:dLbls>
    <!-- ... -->
  </c:dLbls>
  <c:cat>
    <!-- ... -->
  </c:cat>
  <c:val>
    <!-- ... -->
  </c:val>
</c:ser>