diff options
author | Tamas Bunth <tamas.bunth@collabora.co.uk> | 2018-11-26 07:19:41 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-11-26 15:12:15 +0100 |
commit | da957eff1dc2e4b9e49a27799344978af03a6e24 (patch) | |
tree | 7db632ce466608e193e7bc3ca66ed140380fbfab | |
parent | 57b3e2422402a7b700d9d8d67e5e95eda0c35bed (diff) |
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@gmail.com>
(cherry picked from commit 3339c730f8c9a6088a2e8b335185f1bf0b232216)
Reviewed-on: https://gerrit.libreoffice.org/64032
Reviewed-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r-- | chart2/source/view/charttypes/PieChart.cxx | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx index 7f03317b5daa..35e789b52f8f 100644 --- a/chart2/source/view/charttypes/PieChart.cxx +++ b/chart2/source/view/charttypes/PieChart.cxx @@ -1575,7 +1575,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); } } |