From db49cdcf2f367e27ed8fb5f1619f0b41f2c63fd2 Mon Sep 17 00:00:00 2001 From: Tünde Tóth Date: Wed, 30 Sep 2020 13:11:26 +0200 Subject: tdf#137154 pie chart: improve Outside position of data labels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some pie chart data labels were too close to the pie with Outside placement. Change-Id: I0eecdfc32601bdfa8bb3115183f9ca723a9f945b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103683 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh --- chart2/source/view/main/PolarLabelPositionHelper.cxx | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'chart2/source/view') diff --git a/chart2/source/view/main/PolarLabelPositionHelper.cxx b/chart2/source/view/main/PolarLabelPositionHelper.cxx index a3e9a7cd9778..8ebe9ca4c4cc 100644 --- a/chart2/source/view/main/PolarLabelPositionHelper.cxx +++ b/chart2/source/view/main/PolarLabelPositionHelper.cxx @@ -129,26 +129,22 @@ awt::Point PolarLabelPositionHelper::getLabelScreenPositionAndAlignmentForUnitCi bool bOutside = nLabelPlacement == css::chart::DataLabelPlacement::OUTSIDE; - if(fAngleDegree==0.0) - rAlignment = LABEL_ALIGN_CENTER; - else if(fAngleDegree<=22.5) + if (fAngleDegree <= 5 || fAngleDegree >= 355) rAlignment = bOutside ? LABEL_ALIGN_RIGHT : LABEL_ALIGN_LEFT; - else if(fAngleDegree<67.5) + else if (fAngleDegree < 85) rAlignment = bOutside ? LABEL_ALIGN_RIGHT_TOP : LABEL_ALIGN_LEFT_BOTTOM; - else if(fAngleDegree<112.5) + else if (fAngleDegree <= 95) rAlignment = bOutside ? LABEL_ALIGN_TOP : LABEL_ALIGN_BOTTOM; - else if(fAngleDegree<=157.5) + else if (fAngleDegree < 175) rAlignment = bOutside ? LABEL_ALIGN_LEFT_TOP : LABEL_ALIGN_RIGHT_BOTTOM; - else if(fAngleDegree<=202.5) + else if (fAngleDegree <= 185) rAlignment = bOutside ? LABEL_ALIGN_LEFT : LABEL_ALIGN_RIGHT; - else if(fAngleDegree<247.5) + else if (fAngleDegree < 265) rAlignment = bOutside ? LABEL_ALIGN_LEFT_BOTTOM : LABEL_ALIGN_RIGHT_TOP; - else if(fAngleDegree<292.5) + else if (fAngleDegree <= 275) rAlignment = bOutside ? LABEL_ALIGN_BOTTOM : LABEL_ALIGN_TOP; - else if(fAngleDegree<337.5) - rAlignment = bOutside ? LABEL_ALIGN_RIGHT_BOTTOM : LABEL_ALIGN_LEFT_TOP; else - rAlignment = bOutside ? LABEL_ALIGN_RIGHT : LABEL_ALIGN_LEFT; + rAlignment = bOutside ? LABEL_ALIGN_RIGHT_BOTTOM : LABEL_ALIGN_LEFT_TOP; } else { -- cgit