Copying Chart in Calc

I have created tables and a chart on sheet 1. Everything works well. No problem. Then I’ve copied sheet 1 (Ctrl+A) and pasted it on sheet 2. Then I changed all values to zero in order to create a template for future years. All the tables changed correctly but the chart is still in its original shape (identical with the one on sheet 1).

Can someone please tell me the correct way to do this. Many thanks.

Ctrl+A, Ctrl+C, Ctrl+V?.. Weird… Click on the new chart and look at the Data Ranges - maybe the copy of the chart still refers to the previous sheet?

Copy the sheet instead of the cell range (menu:Sheet>Move or copy…).
Instead of switching from sheet to sheet where each sheet has the same layout and chart(s), you may consider to switch data sets on the same sheet by means of scenarios.
See http://forum.openoffice.org/en/forum/download/file.php?id=3004 or http://forum.openoffice.org/en/forum/download/file.php?id=2755
Please ignore any macro warnings when loading old documents of mine. The documents are free of any macros.

1 Like

I found a faulty method, so edited my answer accordingly:

  • You have copied from Sheet1, inserted/moved Sheet2 (or Sheet3) to the left of Sheet1 tab, and pasted.

Solutions:

If Sheet2 tab would be to the left of Sheet1 tab:

  • Copy from Sheet1 after inserting/moving Sheet2

If you already copied from Sheet1, and Sheet2 (or Sheet3) tab is (are) to the left of Sheet1 tab:

  • Move Sheet2 (and Sheet3) tab(s) to the right of Sheet1 tab
  • Paste
  • Reorder the sheet tabs

In my examples, Sheet1 name could have any number; Sheet2 name could have any number greater than Sheet1.

Also, the data range of the chart will remain the same if only the chart is copied.

Tested with LibreOffice 7.1.8.1 on Windows 10.

Related bug reports:

https://bugs.documentfoundation.org/show_bug.cgi?id=99969
https://bugs.documentfoundation.org/show_bug.cgi?id=140868
https://bugs.documentfoundation.org/show_bug.cgi?id=142635

By design, here is how chart ranges are handled when copying and pasting:

  1. The simplest case: when the source chart has an internal data source, the pasted copy always has its own copy of the internal data source.
  2. When the source chart has some Calc ranges as data source (this implies, that the source document is a Calc document):
    2.1. When you paste into a different type of document:
    2.1.1. If you copied only the chart itself (having copied a graphical selection), the pasted chart object will have an own internal data source (a copy of the numbers from the source);
    2.1.2. If you copied a cell range including the chart, a new OLE object will be pasted, with a copy of the selected range, and the chart there will have an own internal data source (a copy of the numbers from the source) - here it is not possible to have a chart referencing the data in the OLE, which is possibly a bug;
    2.2. When you paste to another Calc document:
    2.2.1. If you copied only the chart itself (having copied a graphical selection), the pasted chart object will have an own internal data source (a copy of the numbers from the source);
    2.2.2. If you copied a cell range including the chart, but that doesn’t include the whole chart’s source range(s), the cell range will be pasted to the current place, and the chart pasted together with everything else will have an own internal data source (a copy of the numbers from the source);
    2.2.3. If you copied a cell range including the chart, and also its whole source range(s), the cell range will be pasted to the current place, and the chart pasted together with everything else will refer to the pasted cells in the target Calc document;
    2.3. When you paste to the same Calc document:
    2.3.1. If you copied only the chart itself (having copied a graphical selection), the pasted chart object will refer to the original data range(s);
    2.3.2. If you copied a cell range including the chart, but that doesn’t include the whole chart’s source range(s), the cell range will be pasted to the current place, and the chart pasted together with everything else will refer to the original data range(s);
    2.3.3. If you copied a cell range including the chart, and also its whole source range(s), the cell range will be pasted to the current place, and the chart pasted together with everything else will refer to the pasted cells in the pasted range(s).

To create a template, the simplest way is to re-save your current document to a new file.
There were several bugs - referenced in Copying Chart in Calc - #5 by LeroyG, two of which I fixed yesterday, and one is arguably not a bug…

3 Likes