[Libreoffice-commits] core.git: chart2/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Sep 21 07:42:55 UTC 2018
chart2/source/view/charttypes/BarChart.cxx | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
New commits:
commit 18bda2df4c378b19b6afcd9f3da6accb9f74a663
Author: Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Fri Sep 14 08:58:17 2018 +0200
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Fri Sep 21 09:42:25 2018 +0200
tdf#118705 Fix Column and Bar Chart data label placement
In the OOXML standard the supported data label positions in case of
Column and Bar Chart are Center (ctr), Inside End (inEnd),
Inside Base (inBase) and Outside End (outEnd). So even if the default
value is Above of the date labels placement in LibreOffice,
after the export to OOXML the "DLblPos" will be changed to outEnd.
It is not a problem, but the 0 datapoints value will be appear on the
wrong side of the axis and making itself and the the axis text both
undreadable. This patch will fix it in case of OOXML and ODF format too.
Change-Id: I04d68ee79b560cf144e6290271f2341355a5b089
Reviewed-on: https://gerrit.libreoffice.org/60477
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth at numbertext.org>
Tested-by: László Németh <nemeth at numbertext.org>
diff --git a/chart2/source/view/charttypes/BarChart.cxx b/chart2/source/view/charttypes/BarChart.cxx
index f265f27171fe..70e8e62f5824 100644
--- a/chart2/source/view/charttypes/BarChart.cxx
+++ b/chart2/source/view/charttypes/BarChart.cxx
@@ -244,9 +244,15 @@ awt::Point BarChart::getLabelScreenPositionAndAlignment(
{
fY = (fBaseValue < fScaledUpperYValue) ? fScaledUpperYValue : fScaledLowerYValue;
if( pPosHelper->isSwapXAndY() )
- rAlignment = bNormalOutside ? LABEL_ALIGN_RIGHT : LABEL_ALIGN_LEFT;
+ if( fBaseValue == fScaledUpperYValue && fBaseValue == fScaledLowerYValue )
+ rAlignment = LABEL_ALIGN_RIGHT;
+ else
+ rAlignment = bNormalOutside ? LABEL_ALIGN_RIGHT : LABEL_ALIGN_LEFT;
else
- rAlignment = bNormalOutside ? LABEL_ALIGN_TOP : LABEL_ALIGN_BOTTOM;
+ if( fBaseValue == fScaledUpperYValue && fBaseValue == fScaledLowerYValue )
+ rAlignment = LABEL_ALIGN_TOP;
+ else
+ rAlignment = bNormalOutside ? LABEL_ALIGN_TOP : LABEL_ALIGN_BOTTOM;
if(m_nDimension==3)
fDepth = (fBaseValue < fScaledUpperYValue) ? fabs(fScaledUpperBarDepth) : fabs(fScaledLowerBarDepth);
}
More information about the Libreoffice-commits
mailing list