[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - chart2/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Nov 27 15:01:24 UTC 2018
chart2/source/view/charttypes/PieChart.cxx | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
New commits:
commit 4fae59d27c29011b1bcd6e9db8c43e38dfe50c82
Author: Tamas Bunth <tamas.bunth at collabora.co.uk>
AuthorDate: Mon Nov 26 07:19:41 2018 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Nov 27 16:01:00 2018 +0100
Put text label outside of the pie if..
performLabelBestFitInnerPlacement fails.
Change-Id: Ic84e8b42e02da2023b22a9406c44d462170c5305
Reviewed-on: https://gerrit.libreoffice.org/64015
Tested-by: Jenkins
Reviewed-by: Tamás Bunth <btomi96 at gmail.com>
(cherry picked from commit 3339c730f8c9a6088a2e8b335185f1bf0b232216)
Reviewed-on: https://gerrit.libreoffice.org/64033
Reviewed-by: Andras Timar <andras.timar at collabora.com>
diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx
index f3f1ef3e1cf9..3cc4dc3817ea 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -1590,7 +1590,18 @@ void PieChart::performLabelBestFit(ShapeParam& rShapeParam, PieLabelInfo const &
if( !performLabelBestFitInnerPlacement(rShapeParam, rPieLabelInfo) )
{
- // TODO
+ // If it does not fit inside, let's put it outside
+ PolarLabelPositionHelper aPolarPosHelper(m_pPosHelper.get(),m_nDimension,m_xLogicTarget,m_pShapeFactory);
+ auto eAlignment = LABEL_ALIGN_CENTER;
+ awt::Point aScreenPosition2D(
+ aPolarPosHelper.getLabelScreenPositionAndAlignmentForUnitCircleValues(eAlignment, css::chart::DataLabelPlacement::OUTSIDE
+ , rShapeParam.mfUnitCircleStartAngleDegree, rShapeParam.mfUnitCircleWidthAngleDegree
+ , rShapeParam.mfUnitCircleInnerRadius, rShapeParam.mfUnitCircleOuterRadius, rShapeParam.mfLogicZ+0.5, 0 ));
+ basegfx::B2IVector aTranslationVector = rPieLabelInfo.aFirstPosition - rPieLabelInfo.aOrigin;
+ aTranslationVector.setLength(150);
+ aScreenPosition2D.X += aTranslationVector.getX();
+ aScreenPosition2D.Y += aTranslationVector.getY();
+ rPieLabelInfo.xLabelGroupShape->setPosition(aScreenPosition2D);
}
}
More information about the Libreoffice-commits
mailing list