Bug 153792 - Pasting chart with line drawing object makes it bigger, drawing object might extended beyond chart area.
Summary: Pasting chart with line drawing object makes it bigger, drawing object might ...
Status: RESOLVED DUPLICATE of bug 145599
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Chart (show other bugs)
Version:
(earliest affected)
7.2.7.2 release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Chart
  Show dependency treegraph
 
Reported: 2023-02-23 17:25 UTC by wpeaton4
Modified: 2023-03-09 10:14 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
calc sheet with charts and pasted charts (108.83 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-02-23 17:28 UTC, wpeaton4
Details

Note You need to log in before you can comment on or make changes to this bug.
Description wpeaton4 2023-02-23 17:25:49 UTC
Description:
If you create a chart and draw lines in it with the draw tools, the graphics become distorted on paste. Other draw objects (text box, rectangle) work fine.

Steps to Reproduce:
1.Create a Chart in Calc
2.Edit the Chart and draw a line object
3.Copy the chart
4.Paste the chart. Chart will be distorted.

Actual Results:
Length and position of pasted line varies depending on paste format. Relative size of chart area varies depending on paste format.

Expected Results:
pasted chart should look identical to copied chart and relative size and position of all chart elements and all drawn elements should be reproduced exactly.


Reproducible: Always


User Profile Reset: No

Additional Info:
Workarounds is either (A) do no draw lines. This is not realistic as some users will feel a need to draw lines on their charts. (B) export the chart as an image. This will work for users wanting to paste the chart as a figure in e.g. Writer for a report. But will not be helpful for users wanting to pasted the chart as an editable chart in Calc.
Comment 1 wpeaton4 2023-02-23 17:28:00 UTC
Created attachment 185553 [details]
calc sheet with charts and pasted charts
Comment 2 Stéphane Guillou (stragu) 2023-02-24 12:11:19 UTC
Reproduced in recent master build:

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 6d9b9d1228cdee69e767833202442a1fed6174a6
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Results:
- as GDI: blue arrow is right size, but all text is lost (which I think is the same regression as bug 153544)
- as BMP or PNG: blue arrow is right size but is cropped, both red curve and blue arrow have a "stair" effect.

6.0 already had the distortion in raster formats:

Version: 6.0.0.3
Build ID: 64a0f66915f38c6217de274f0aa8e15618924765
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk2; 
Locale: en-AU (en_AU.UTF-8); Calc: group

I think the stair effect / anti-aliasing issue is covered by bug 78899.

Maybe this report can be focused on objects being cropped outside of the chart area?
Comment 3 Stéphane Guillou (stragu) 2023-03-07 09:38:23 UTC
I think I understand better the issue wpeaton reported.

I tested again with:

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: feda414f8b70f50a9f6745d2ce8828316d4711cd
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

... which includes the fix for bug 153544 and fixed the disappearing labels issue.

Results:

If a drawing object goes beyond the chart area, all the other elements are scaled down to make everything fit inside the chart frame. This can be seen by going in and out of edit mode of the chart with the arrow:
- everything is "squished" inside the frame when out of edit mode
- arrow goes beyond the frame, visually cropped when in edit mode.

And we get different results depending on the kind of paste, or the kind of export:

- Paste as default, XML Star Object Descriptor, or GDI: "squished" version
- Paste as raster (PNG or BMP): "cropped" version
- Export as SVG or PNG: "squished" version

I guess the issue could be reworded as "chart area should expand to include all objects".

My question is: how does one draw an arrow that goes beyond the chart area? Drawing a new line should stop at the edge, and moving the existing object makes it jump back to fit inside the chart area. Even changing the values in the Position and Size dialog does not allow that.
How did you create the original chart?
Comment 4 V Stuart Foote 2023-03-08 14:56:19 UTC
Looking at related bug 154065

@wpeaton4, how did you create the line extending outside the chart area?  If I select and move it inside the chart extent its end can not be pushed back outside the chart.  Similarly editing a new draw object on a chart can not position beyond the edge of the chart.

So how?
Comment 5 Stéphane Guillou (stragu) 2023-03-08 16:02:44 UTC
I figured out I can create such chart by copying a large shape outside of the chart and pasting it inside the chart.

MS Excel behaviour is that the drawing object is scaled down to fit the chart area. Apart from that, it is consistent in LO in that a drawing object created inside the chart can't be extended beyond the chart area (as far as I've tested).
Comment 6 wpeaton4 2023-03-08 22:16:39 UTC
In my version of LibO (7.2.7.2) and OS (Windoze), I always get funny behavior when I have a drawn line in a chart and then copy and paste said chart. It doesn't matter if the line is inside or outside the chart axes. It can be a regular line or a freeform line.

So to respond to stragu and vsfoote, the only way I know to create a line that extends outside the chart area is to copy and paste the chart and it will happen automatically. If you look at the attached file, the original chart is on the first sheet ("data and chart"). The pasted charts are on the second sheet ("chart copies").

Other drawing objects are well behaved. Boxes, text boxes. Even callouts (which have lines) will copy and paste fine.

Polygons are wonky. You can't draw them inside of a chart. But if you paste one inside of a chart, it will not behave well when the whole chart is copied and pasted.
Comment 7 Stéphane Guillou (stragu) 2023-03-09 08:31:41 UTC
Right, thank you for clarifying, I didn't even realise the original chart was on the first sheet!
I see what you mean, I can reproduce the sheet 1 chart's short arrow getting bigger when pasting, in LO 7.2.7.2 and 7.3.7.2, to different extents depending on what kind of pasting it is. It used to behave normally in 7.1.0.3

I am changing the summary again to reflect that.

Now, this makes your issue a duplicate of bug 145599, which is already fixed in branches 7.4 and 7.5. Please update to one of those and you should see it works as expected.

The issue with copy-pasting a chart that has a pre-existing drawing object expanding beyond the chart area (described in comment 3) remains, but I will open a new bug report about that, focusing on the fact the a drawing object probably should not be allowed to go beyond the edges of the chart area.

Thank you!

*** This bug has been marked as a duplicate of bug 145599 ***