Bug 94004 - Trend line equation should fit in chart
Summary: Trend line equation should fit in chart
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Chart (show other bugs)
Version:
(earliest affected)
4.2.0.4 release
Hardware: Other All
: medium normal
Assignee: Laurent Balland
URL:
Whiteboard: target:5.2.0 target:5.3.0 target:5.2.0.1
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-07 20:41 UTC by Laurent Balland
Modified: 2016-10-25 18:54 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Test document with a long trend line equation (37.23 KB, application/vnd.oasis.opendocument.spreadsheet)
2015-09-07 20:41 UTC, Laurent Balland
Details
Screen shot of chart opened : end of equation not visible (17.43 KB, image/png)
2016-01-08 20:36 UTC, Laurent Balland
Details
Screen shot of chart closed : chart is squeezed (19.04 KB, image/png)
2016-01-08 20:37 UTC, Laurent Balland
Details
Screen shot comparison (Gnumeric, Excel, LibO) for same polynomial equation (52.68 KB, image/png)
2016-01-21 22:40 UTC, Laurent Balland
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Laurent Balland 2015-09-07 20:41:11 UTC
Created attachment 118510 [details]
Test document with a long trend line equation

Description: if chart width is narrower than trendline equation length, then it is not possible to see the end of equation

Steps to reproduce:
1. Open chart in attached test spreadsheet or create it:
  1.a Enter XY data with more than 10 lines
  1.b Create XY scatter diagram with these data
  1.c Insert polynomial trend line, degree=8 and check equation

Actual behavior:
End of equation is not visible
When chart is closed, it appears squeezed

Expected behavior:
The number of digits should be automatically reduced to fit in width

Work around:
Change font size, or change number format of equation.
Or increase chart width.
Comment 1 A (Andy) 2016-01-04 21:00:56 UTC
Reproducible with 5.1.0.1, Win 8.1

Remark to Step 1.c: select the data points, make a right mouse click, select "Insert Trend Line", select "Polynomial" regression type with "Degree" = 8 and check "Show Equation"
Comment 2 Laurent Balland 2016-01-08 20:36:27 UTC
Created attachment 121807 [details]
Screen shot of chart opened : end of equation not visible
Comment 3 Laurent Balland 2016-01-08 20:37:46 UTC
Created attachment 121808 [details]
Screen shot of chart closed : chart is squeezed
Comment 4 Heiko Tietze 2016-01-12 11:02:57 UTC
Based on what you wrote on the ML [1] I'd say we have more than 

(a) if General format is used for equation, number of decimal digits should be adapted to fit equation in chart width 
(b) we should alert user that equation is too long and let him make a decision: change number format, change font size, increase chart width 

Quick ideas are:

(c) wrap the text so the legend cannot exceed the graph width
(d) abbreviate with ellipsis overlong text and let the user decide what to do (manual or automatic word warp, shorten the numbers etc.)

I agree that (a) doesn't solve the issue ultimately and that cutting the long text is a good solution, whether with your red triangle or my ellipsis. What we should avoid is to interrupt the user's workflow by asking questions like 'Do you want to use this or that format?'. Rather he or she must be able to change our best practice proposal by changing the number format, modifying the text, using a sane trendline etc. 

[1] http://nabble.documentfoundation.org/Chart-what-to-do-when-trendline-regression-equation-is-too-long-tdf-94004-td4171208.html
Comment 5 Laurent Balland 2016-01-21 22:40:15 UTC
Created attachment 122134 [details]
Screen shot comparison (Gnumeric, Excel, LibO) for same polynomial equation

Looking at Gnumeric (see attached screen shots with default parameter for Gnumeric, LibO and Excel with the same polynomial equation), where equation looks smarter, raise two solutions:
- wrap equation if it is too long (solution c) in comment 4)
- reduce number of significant digits in General format: as equation has no limited width, LibO displays up to 14 significant digits (whereas Gnumeric limits to 6 and Excel 5) which seems far too much as a default display.

I would then propose, a mix of solution c) and a):
- if equation has Number format (not General format): display equation up to chart width, then wrap if necessary
- if equation has General format: decrease number of digits down to 6 till equation width exceed chart width. If equation width still exceed chart width, then wrap equation.

This will avoid cutting equation (with ellipsis or red triangle).
Comment 6 Commit Notification 2016-05-22 19:12:47 UTC
Laurent Balland-Poirier committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=033b2ae8775d1dcf49f798e267761000cc51627c

tdf#94004 Trendline: wrap equation to fit in chart area

It will be available in 5.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Heiko Tietze 2016-05-27 09:11:48 UTC
Looks good now. At least all handles are in range so the user can adjust position and size. Close as FIXED?

Version: 5.3.0.0.alpha0+ (x64)
Build ID: e10a4c1cc9f8b2033997c7f032255071aafab9c9
CPU Threads: 2; OS Version: Windows 6.1; UI Render: default; 
TinderBox: Win-x86_64@62-TDF, Branch:MASTER, Time: 2016-05-27_00:12:19
Locale: de-DE (de_DE)
Comment 8 Laurent Balland 2016-05-27 16:03:41 UTC
(In reply to Heiko Tietze from comment #7)
> Looks good now. At least all handles are in range so the user can adjust
> position and size. Close as FIXED?
> 
> Version: 5.3.0.0.alpha0+ (x64)
> Build ID: e10a4c1cc9f8b2033997c7f032255071aafab9c9
> CPU Threads: 2; OS Version: Windows 6.1; UI Render: default; 
> TinderBox: Win-x86_64@62-TDF, Branch:MASTER, Time: 2016-05-27_00:12:19
> Locale: de-DE (de_DE)

User cannot resize equation with handles.
Only polynomial trend line equations are wrapped. Some commits are pending review for other trendline types:
- exponential trend line https://gerrit.libreoffice.org/25393/
- logarithmic trend line https://gerrit.libreoffice.org/25416/
- power trend line https://gerrit.libreoffice.org/25418/
Comment 9 Heiko Tietze 2016-05-29 07:52:39 UTC
(In reply to Laurent BP from comment #8)
> User cannot resize equation with handles.

I see. That means the current solution fixes only the most pressing issue because the equation would always cover part of the graph. Why don't you add the formula as normal text with standard word wrap? (And add a protection flag for the content in this case the formula, perhaps.) 

The workaround with the current solution is to resize the graph, which update the equation size properly, to cut the equation and paste it into the resized graph.
Comment 10 Laurent Balland 2016-05-29 12:10:58 UTC
(In reply to Heiko Tietze from comment #9)
> I see. That means the current solution fixes only the most pressing issue
> because the equation would always cover part of the graph.
It is then a different issue. This bug reports problem with squeezed chart. See attachment 121808 [details]. Open a new bug report for manual resizing of equation.

> Why don't you add
> the formula as normal text with standard word wrap?
If I knew how to do it, I would ;-) It could help fixing bug 77744, and have a nicer equation rendering with superscript (for power trendline for instance).

> The workaround with the current solution is to resize the graph, which
> update the equation size properly, to cut the equation and paste it into the
> resized graph.
Nice one :)
Comment 11 Commit Notification 2016-06-09 10:23:28 UTC
Laurent Balland-Poirier committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=9a9c778d81e8ae54dcc42290241a5fc72be29bf2

tdf#94004 Wrap Exponential trendline equation

It will be available in 5.3.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 Commit Notification 2016-06-09 10:32:38 UTC
Laurent Balland-Poirier committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=4d636391e3e588779c88c566ac7df5fd1990afea

tdf#94004 Wrap Logarithmic trendline equation

It will be available in 5.3.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 13 Commit Notification 2016-06-09 11:01:17 UTC
Laurent Balland-Poirier committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e420a335f783bb4d2ee9d74d56f91e16d189566f

tdf#94004 Wrap Power trendline equation

It will be available in 5.3.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 14 Commit Notification 2016-06-19 07:28:53 UTC
Laurent Balland-Poirier committed a patch related to this issue.
It has been pushed to "libreoffice-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=4cbfcf64297f3b8826c351a1dd3306a3510e8073&h=libreoffice-5-2

tdf#94004 Wrap Exponential trendline equation

It will be available in 5.2.0.1.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 15 Commit Notification 2016-06-19 07:28:57 UTC
Laurent Balland-Poirier committed a patch related to this issue.
It has been pushed to "libreoffice-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d1f56846a72697bf55f0330a7b5d0e385bf4a5cb&h=libreoffice-5-2

tdf#94004 Wrap Logarithmic trendline equation

It will be available in 5.2.0.1.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 16 Commit Notification 2016-06-19 07:29:01 UTC
Laurent Balland-Poirier committed a patch related to this issue.
It has been pushed to "libreoffice-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=23d389384950c7a558e6c436282a4da0ff4f9054&h=libreoffice-5-2

tdf#94004 Wrap Power trendline equation

It will be available in 5.2.0.1.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.