Bug 152462 - Trend Lines do not get created correctly if a dataset is re-ordered by sorting the table.
Summary: Trend Lines do not get created correctly if a dataset is re-ordered by sortin...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Chart (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Depends on:
Blocks: Chart-Trendlines
  Show dependency treegraph
Reported: 2022-12-11 11:10 UTC by Gareth
Modified: 2023-03-09 13:02 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:

Trendline on a graph where the original data was then sorted by a different column (540.12 KB, image/jpeg)
2022-12-11 11:10 UTC, Gareth
This simple spreadsheet demonstrates the problem (31.85 KB, application/vnd.oasis.opendocument.spreadsheet)
2022-12-11 18:32 UTC, Gareth

Note You need to log in before you can comment on or make changes to this bug.
Description Gareth 2022-12-11 11:10:59 UTC
Created attachment 184088 [details]
Trendline on a graph where the original data was then sorted by a different column

Trend Lines appear to be created from raw table data so appear as a childlike scribble if table is re-sorted (graph is correct still though). It's very artistic looking, but totally useless.

This has been broken since at least version 7.3 and I think well before.

I've attached an image showing a 14 point moving average on a roughly 200 datapoint bar chart style graph to demonstrate the problem.

If you resort into natural order again, then the trendline is correctly drawn hence my theory that the trendline is being drawn from the original table data rather than that used for rendering the graph.
Comment 1 LeroyG 2022-12-11 17:20:24 UTC
> Created attachment 184088 [details]

The screenshot its OK to see what do you wrote. But, please, share the spreadsheet to test on it. Thanks.
But what I can see, the chart seems to be a Column and Line chart, not a Column chart with trend line.
Comment 2 Gareth 2022-12-11 18:16:32 UTC
To be absolutely clear, this is a line chart with a moving average trend line.
No you cannot have the spreadsheet, it is proprietary data. I looked at what is needed to submit a bug report, and that was not part of the information requested.

I'll see if I can create a new basic spreadsheet demonstrating the behaviour instead.
Comment 3 Gareth 2022-12-11 18:17:43 UTC
Sorry - "normal column chart"
Comment 4 Gareth 2022-12-11 18:32:40 UTC
Created attachment 184097 [details]
This simple spreadsheet demonstrates the problem

Here is a simple spreadsheet to prove the same 'feature'.

Note that the x axis column must be a series of dates to cause the bizarre issue. I tried with an incrementing sequence first and that didn't do the trick.
Comment 5 Gareth 2022-12-11 18:33:10 UTC
I've now uploaded a demonstration spreadsheet.
Comment 6 Buovjaga 2023-03-09 13:02:27 UTC
I repro: I clicked the Random number autofilter and sorted ascending. Already seen in 5.2 and 4.2.

Arch Linux 64-bit, X11
Version: (X86_64) / LibreOffice Community
Build ID: 013fbfb592f71c1f0a60b6a7ec08aded375515ac
CPU threads: 8; OS: Linux 6.2; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 9 March 2023