Bug 146067 - MA trend lines are displayed with inconsistent X offset, depending on the label values
Summary: MA trend lines are displayed with inconsistent X offset, depending on the lab...
Status: RESOLVED INSUFFICIENTDATA
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.2.2.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-05 21:13 UTC by Hernan
Modified: 2023-07-02 06:51 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Capture with different label types (16.83 KB, image/png)
2021-12-05 21:22 UTC, Hernan
Details
My own sample document with screenshot (163.42 KB, application/vnd.oasis.opendocument.spreadsheet)
2021-12-06 06:00 UTC, Rainer Bielefeld Retired
Details
my sample file (16.06 KB, application/vnd.oasis.opendocument.spreadsheet)
2021-12-06 10:56 UTC, Hernan
Details
New sample document with modified Numbers (168.80 KB, application/vnd.oasis.opendocument.spreadsheet)
2021-12-06 11:20 UTC, Rainer Bielefeld Retired
Details
20221202_146067_repro_attempt (15.09 KB, application/vnd.oasis.opendocument.spreadsheet)
2022-12-02 09:20 UTC, sockseight
Details
Diagrams created and saved in various LibO Versions (342.13 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-07-02 06:51 UTC, Rainer Bielefeld Retired
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hernan 2021-12-05 21:13:33 UTC
Description:
For some cases of column labels (dates) the trend lines are displayed wrong, with a displacement in the X direction, equal to half of the X interval.

Steps to Reproduce:
1. On a blank Calc sheet, create a first column (A1:A7) with dates (I've used 2021-05-15, 2021-06-15 ... ), format as MM-AA
2. Create a second column (B1:B7) with the numbers (20, 10, 20, 30, 20, 20, 40)
3. Select filled cells, insert graph: select line type 
4. In the second step of the wizard, select defaults: "Data series in columns / First column as label" . Click Finish.
5. If the graph is cropped (bug 146066), you may fix the Y axis range to 0-45.
6. Right click over the data series, insert Trend line, select Moving average, Period=2, Type=Prior

Actual Results:
The trend line is wrong, it's displaced to the right by a distance equal to half-interval. That's especially noticiable on the rightmost point (its MA value should be 30, it's seen as 25), and also is noticiable in the inflection points not being aligned with the main graph. 

Expected Results:
The trend line should be shifted to the left, with its inflection points aligned with the main graph.


Reproducible: Always


User Profile Reset: Yes



Additional Info:
The problem persists for the "Central" MA variant

The problem disappears if the values of the label column are deleted, or set to numeric or string values.

If the "Averaged abcisas" is selected, the offset is still inconsistent (dependent on the label column type), but I'm not sure which is the right one. (I'd say that here we'd indeed expect the inflection points to be located between the graph values - again, this assumption is violated when the label column contain dates).
Comment 1 Hernan 2021-12-05 21:13:59 UTC
Might have some relation with https://bugs.documentfoundation.org/show_bug.cgi?id=146066
Comment 2 Hernan 2021-12-05 21:22:19 UTC
Created attachment 176716 [details]
Capture with different label types
Comment 3 Hernan 2021-12-05 23:50:41 UTC
Additional Info:
Version: 7.2.2.2 (x64) / LibreOffice Community
Build ID: 02b2acce88a210515b4a5bb2e46cbfb63fe97d56
CPU threads: 6; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: es-AR (es_AR); UI: en-US
Calc: CL
Comment 4 Rainer Bielefeld Retired 2021-12-06 06:00:57 UTC
Created attachment 176723 [details]
My own sample document with screenshot

NOT reproducible with own test and  Installation of Version 7.2.3.2 (x64) / LibreOffice Build  d166454616c1632304285822f9c83ce2e660fd92; CPU threads: 12; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win; Locale: de-DE (de_DE); UI: de-DE; Calc: threaded;  My normal User Profile

@Reporter:
Please tell 
a) did I make a mistake when I tried to reproduce?
b) details concerning your OS ...
c) what do you see opening my sample document?
d) please open your sample document!
Comment 5 Rainer Bielefeld Retired 2021-12-06 06:50:55 UTC
@Reporter
d) please ATTACH your sample document!
e)may be your dates are 15.05., 15.06 ... instead of 01.05, 01.06. ...?
Comment 6 Hernan 2021-12-06 10:56:39 UTC
Created attachment 176727 [details]
my sample file
Comment 7 Hernan 2021-12-06 10:58:33 UTC
@Rainer 
I've added my sample file
You're right, the bug does not manifest when dates are 2021-05-01, 2021-06-01...
but when they are 2021-05-15, 2021-06-15...
Comment 8 Hernan 2021-12-06 11:11:20 UTC
The issue seems to be related with the calculation of the X-axis automatic range, see also bug 146066
Comment 9 Rainer Bielefeld Retired 2021-12-06 11:20:58 UTC
Created attachment 176730 [details]
New sample document with modified Numbers

So there might be no bug. But:

In my new sample I compare diagram 
for x axis numbers    5 ...  11        with diagram
for x axis numbers  5,49 ... 11,49 

I expected that in 5,49 ... trend line would look like dates 2021-05-15 ...,
but it does not. I am not familiar with those trend lines.

@Hernan
What is your comment for this?
Comment 10 Hernan 2021-12-06 11:40:30 UTC
Your examples with numeric X-values work fine.

To clarify, the expected behaviour for a Moving Average trend line for MA=2, variant Prior is (I'm assumming) : 

- For each point in the original series a new point is generated with the same same abcissa, and with a Y-value given by the average of the original point and the previous one. Then the points are joined by straight lines.
Comment 11 sockseight 2022-12-02 09:20:41 UTC
Created attachment 183950 [details]
20221202_146067_repro_attempt

20221202_146067_reproduce_attempt
Comment 12 sockseight 2022-12-02 10:37:43 UTC
Following are the steps performed recently,


Steps:
1) select cells A1:A10, then right-click "Format cells"
2) select "Category: Date", "Format: 1999-12-31", "Format Code: YYYY-MM-DD"
3) fill in cells from A1 to A7 with date range 05-2022 to 11-2022
4) fill in cells from B1 to B7 with numeric values as follows 20, 10, 20, 30, 20, 20, 40
5) select cells A1:B7, then from the menu "Insert" -> "Chart"
6) select "Choose a Chart Type: Line" and select "Points and Lines", click "Next"
7) ensure default values are selected / enabled like "Data series in columns" and "First column as label", click "Finish"
8) right click on Line graph that is generated. select "Insert Trend Line..."
9) select "Moving Average", with the default values "Period: 2", "Type: Prior", click "OK"

Actual Result:
The Moving Average[MA] is set to 30.

A sample file used for the outcome is attached.

tested in version:

Version: 7.4.3.2 (x64) / LibreOffice Community
Build ID: 1048a8393ae2eeec98dff31b5c133c5f1d08b890
CPU threads: 8; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: en-IN (en_IN); UI: en-US
Calc: threaded


Version: 7.5.0.0.alpha1+ (x64_64) / LibreOffice Community
Build ID: 982f9ec1e07364e317fbcd25f1ef06f984cc0ce8
CPU threads: 3; OS: Linux 5.10; UI render: default; VCL: gtk3
Locale: en-IN (en_IN); UI: en-US
Calc: threaded


Hello,

Thank you for reporting the bug. Can you please confirm if the issue still exists in the latest build?


Could you please try to reproduce it with a master build from https://dev-builds.libreoffice.org/daily/master/ ?
You can install it alongside the standard version.

I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' if the bug is still present in the master build.
Comment 13 QA Administrators 2023-06-01 03:19:07 UTC Comment hidden (obsolete)
Comment 14 QA Administrators 2023-07-02 03:13:06 UTC Comment hidden (obsolete)
Comment 15 Rainer Bielefeld Retired 2023-07-02 06:51:32 UTC
Created attachment 188156 [details]
Diagrams created and saved in various LibO Versions

Well, there IS a problem, but I can't find out which one.

I edited reporter's sample document with LibO 7.6, then with 4.0, and again with 7.6 and saw various strange effects with Trend Lines and Mean Value Lines. But But an expert will have to find out which effects are intended and which ones are bugs.