From a3dfc463edaef1afceb12b81e802db8ba0e4b947 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alain=20B=C3=A9arez?= Date: Wed, 29 Jan 2020 06:38:22 +0000 Subject: [PATCH] Invert bar chart if negative by Niklas Mollenhauer git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1873282 13f79535-47bb-0310-9956-ffa450edef68 --- .../usermodel/chart/XDDFBar3DChartData.java | 21 +++++++++++++++++++ .../usermodel/chart/XDDFBarChartData.java | 21 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBar3DChartData.java b/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBar3DChartData.java index 666802b1fa..263e8c1324 100644 --- a/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBar3DChartData.java +++ b/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBar3DChartData.java @@ -251,6 +251,27 @@ public class XDDFBar3DChartData extends XDDFChartData { } } + /** + * @since 4.1.2 + */ + public boolean getInvertIfNegative() { + if (series.isSetInvertIfNegative()) { + return series.getInvertIfNegative().getVal(); + } + return false; + } + + /** + * @since 4.1.2 + */ + public void setInvertIfNegative(boolean invertIfNegative) { + if (series.isSetInvertIfNegative()) { + series.getInvertIfNegative().setVal(invertIfNegative); + } else { + series.addNewInvertIfNegative().setVal(invertIfNegative); + } + } + @Override public void setShowLeaderLines(boolean showLeaderLines) { if (!series.isSetDLbls()) { diff --git a/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBarChartData.java b/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBarChartData.java index 4261212d33..85f75ffe5f 100644 --- a/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBarChartData.java +++ b/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBarChartData.java @@ -241,6 +241,27 @@ public class XDDFBarChartData extends XDDFChartData { } } + /** + * @since 4.1.2 + */ + public boolean getInvertIfNegative() { + if (series.isSetInvertIfNegative()) { + return series.getInvertIfNegative().getVal(); + } + return false; + } + + /** + * @since 4.1.2 + */ + public void setInvertIfNegative(boolean invertIfNegative) { + if (series.isSetInvertIfNegative()) { + series.getInvertIfNegative().setVal(invertIfNegative); + } else { + series.addNewInvertIfNegative().setVal(invertIfNegative); + } + } + @Override public void setShowLeaderLines(boolean showLeaderLines) { if (!series.isSetDLbls()) { -- 2.39.5