Bug 134224 - Pie chart data rounding error
Summary: Pie chart data rounding error
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Chart (show other bugs)
Version:
(earliest affected)
6.2.0.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Pie-and-Donut
  Show dependency treegraph
 
Reported: 2020-06-22 07:56 UTC by NISZ LibreOffice Team
Modified: 2024-10-15 21:13 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file from Word (13.34 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-06-22 07:56 UTC, NISZ LibreOffice Team
Details
Screenshot of the original document side by side in Word and Writer (66.69 KB, image/png)
2020-06-22 07:56 UTC, NISZ LibreOffice Team
Details

Note You need to log in before you can comment on or make changes to this bug.
Description NISZ LibreOffice Team 2020-06-22 07:56:20 UTC
Created attachment 162297 [details]
Example file from Word

Attached user made document contains a simple pie chart with data labels formatted as percentage.
When opened in Writer one of the values is incorrectly rounded from 19% to 20%, making the grand total of 101%.

Steps to reproduce:
    1. Open attached document

Actual results:
Pie label is 20% instead of 19%.

Expected results:
Data labels match.

LibreOffice details:
Version: 7.1.0.0.alpha0+ (x64)
Build ID: 642fc41cd7d080384658e10b30bb9d3b38a2cbd9
CPU szálak: 4; OS: Windows 6.3 Build 9600; Felületmegjelenítés: alapértelmezett; VCL: win
Locale: hu-HU (hu_HU); UI: hu-HU
Calc: CL

Also in:
Verzió: 6.2.0.3
Build az.: 98c6a8a1c6c7b144ce3cc729e34964b47ce25d62
CPU szálak: 4; OS: Windows 6.3; Felületmegjelenítés: GL; VCL: win; 
Területi beállítások: hu-HU (hu_HU); UI nyelve: hu-HU
Calc: threaded

Data (58.70% ; 21.74%; 19.57%) was not rounded to whole numbers in:

Verzió: 6.1.0.3
Build az.: efb621ed25068d70781dc026f7e9c5187a4decd1
CPU szálak: 4; OS: Windows 6.3; Felületmegjelenítés: alapértelmezett; 
Területi beállítások: hu-HU (hu_HU); Calc: CL
Comment 1 NISZ LibreOffice Team 2020-06-22 07:56:36 UTC
Created attachment 162298 [details]
Screenshot of the original document side by side in Word and Writer
Comment 2 Xisco Faulí 2020-06-22 13:17:24 UTC
Reproduced in

Version: 7.1.0.0.alpha0+
Build ID: 70479e1f4cb3c120f46239a648e65f035af2922d
CPU threads: 4; OS: Linux 4.19; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 3 Leyan 2020-08-30 21:38:11 UTC
The rounding of each percentage is correct, the fact that the sum is 101 is just an artifact of the insufficient precision displayed. So the question is whether it is better to have less precise individual values and a nicer total or whether the current behavior should be kept?

I played a bit with it in Excel, this is only applied for integer percentage values, not when there is additional precision displayed. A pie chart with three identical parts will sum to 100% when the display format is 0% but 99.9% when it is 0.0%. 

For these integer percentage values, the algorithm used seems to be to change the displayed value by 1 for as many labels as necessary, starting with the labels closest to 0.5. 

This simple algorithm can lead to pie charts displaying different percentages even if the underlying value is the same, which is not great in my opinion. For example, with a pie chart with 3 identical parts, the percentages displayed will be 34%, 33%, 33%.
Comment 4 NISZ LibreOffice Team 2020-08-31 06:39:00 UTC
(In reply to Leyan from comment #3)
> The rounding of each percentage is correct, the fact that the sum is 101 is
> just an artifact of the insufficient precision displayed. So the question is
> whether it is better to have less precise individual values and a nicer
> total or whether the current behavior should be kept?
> 
Hi

Thanks for your comment. Yes this is exactly the question here. 
Adding UX-advise list for help to decide :).

(snip)

> This simple algorithm can lead to pie charts displaying different
> percentages even if the underlying value is the same, which is not great in
> my opinion. For example, with a pie chart with 3 identical parts, the
> percentages displayed will be 34%, 33%, 33%.

Just like in Excel. My hunch is that our users would prefer it this way, so that on papers printed from Excel/Calc would be no difference. 
But this behavior might be made configurable, so that (enterprise) users/sysadmins could centrally configure Excel-like behavior.
Comment 5 Heiko Tietze 2020-09-01 12:44:49 UTC
1.4+1.4+1.4 = 4.2 ~ 4 = 1+1+1 = 3
1.6+1.6+1.6 = 4.8 ~ 5 = 2+2+2 = 6

Usually the individual values are rounded but the last which takes up the remaining portion to 100.

1.4+1.4+1.4 = 4.2 ~ 4 = 1+1+2 = 4 # rnd(4.2)-(1+1)=2
1.6+1.6+1.6 = 4.8 ~ 5 = 2+2+1 = 5 # rnd(4.8)-(2+2)=1
Comment 6 QA Administrators 2022-09-02 03:38:42 UTC Comment hidden (obsolete)
Comment 7 QA Administrators 2024-09-02 03:14:15 UTC
Dear NISZ LibreOffice Team,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug