summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorTünde Tóth <tundeth@gmail.com>2020-07-24 10:06:40 +0200
committerLászló Németh <nemeth@numbertext.org>2020-07-27 14:11:10 +0200
commitc0fac974cefffb16e811259fbc66148712533190 (patch)
treeaf6ca82abeaebbc3a79ea95388b361e01198a368 /chart2
parent055735fa8589670f67e016bc3b7835d4cf81641f (diff)
tdf#134866 Chart OOXML import: fix percentage in custom pie chart label
Custom pie chart label showed incorrect percentage value. Follow-up of commit 8c1dc30cc9fc96ef3d3ab0c4445959473248ae4d (tdf#125444 Percentage as custom chart label). Change-Id: I2fe9cbca876da26a7c3a371c1e711b9e1fc33b1e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99353 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/view/charttypes/VSeriesPlotter.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index dbb8dbd8fbd4..14b322e8f587 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -533,7 +533,13 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re
}
case DataPointCustomLabelFieldType_PERCENTAGE:
{
- aTextList[i] = getLabelTextForValue( rDataSeries, nPointIndex, fValue, true );
+ if(fSumValue == 0.0)
+ fSumValue = 1.0;
+ fValue /= fSumValue;
+ if(fValue < 0)
+ fValue *= -1.0;
+
+ aTextList[i] = getLabelTextForValue(rDataSeries, nPointIndex, fValue, true);
break;
}
case DataPointCustomLabelFieldType_CELLREF: