Issue 120559 - Pasting graphs from Excel into Impress(not sure about others) does not use original selection of x and y data ranges. Arbitrarily changes x and y ranges into columns.
Pasting graphs from Excel into Impress(not sure about others) does not use or...
Status: RESOLVED FIXED
Product: General
Classification: Code
Component: chart
OOo 3.3 or older
PC Windows 7
: P3 major (vote)
: 4.0.0
Assigned To: Armin Le Grand
: regression
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-14 03:57 UTC by bananaphone103
Modified: 2013-07-12 16:19 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation on: ---
Developer Difficulty: ---
jsc: 4.0.0_release_blocker+


Attachments
I think try copying this graph in impress. I haven't been able to reproduce the problem again... When I paste the graph into impress now, it simply doesn't show up. (12.91 KB, application/Calc)
2012-08-14 04:15 UTC, bananaphone103
no flags Details
Screenshot 3.3.0 with chart pasted in new ODS (193.20 KB, image/png)
2012-12-10 10:06 UTC, oooforum
no flags Details
paste the chart of banaphone on a new calc (156.70 KB, image/png)
2013-06-08 13:00 UTC, papayes
no flags Details
paste the chart of banaphone on a new calc with 4.0.0_r1499347 (88.68 KB, image/png)
2013-07-09 07:32 UTC, fanyuzhen
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description bananaphone103 2012-08-14 03:57:09 UTC
My chart in Excel was a xy scatterplot, with x data range a row, and y data range also a row. The chart was formed with the data in the worksheet. I copy pasted the chart into impress but it did not retain x and y data ranges as rows. Ranges were moved automatically into columns.
Comment 1 bananaphone103 2012-08-14 04:15:18 UTC
Created attachment 78927 [details]
I think try copying this graph in impress. I haven't been able to reproduce the problem again... When I paste the graph into impress now, it simply doesn't show up.

In the attachment I put a bunch of 1000's below , I was hoping for the pasted graph to plot 1000. the problem hasn't happened to me again, although now the graph just doesn't show up at all.
Comment 2 oooforum 2012-11-07 08:31:06 UTC
I confirm this issue.
Three additionnal comments:
- this is not an XLS problem, it occurs with ODS
- not linked to specific chart, all types is concerned
- pasting action loses chart datas in all apps (Writer or Calc)

Maybe same bug than https://issues.apache.org/ooo/show_bug.cgi?id=118840

Thanks to have a look, this is a cruel regression.
Comment 3 Andrea Pescetti 2012-12-09 21:23:51 UTC
Is this a regression? I experience the same behavior in 3.3.0.

Steps:
1) Open the test document by bananaphone103
2) Right-click the chart, then Copy
3) Paste in the same document: the pasted chart is identical to the original one
4) Paste in a new Calc document: the pasted chart differs from the original one

I experience the same behavior in 3.4.1.

(If it works in 3.3.0, it's easier to identify when it broke)
Comment 4 oooforum 2012-12-10 10:05:09 UTC
Hello Andrea,
I did it with a 3.3.0 and Win2008 TSE.
The problem don't occur.
Comment 5 oooforum 2012-12-10 10:06:48 UTC
Created attachment 80015 [details]
Screenshot 3.3.0 with chart pasted in new ODS
Comment 6 Andrea Pescetti 2012-12-15 21:28:58 UTC
Marking regression. Indeed it is a bit tricky:
- OpenOffice.org 3.2.1 Linux 64-bit: broken (no red/blue lines in pasted chart)
- OpenOffice.org 3.3.0 Linux 64-bit: broken (lines become diagonal)
- OpenOffice.org 3.3.0 Windows: works (so, regression!)
- OpenOffice 3.4.0-beta (April 2011) Windows: still works
- OpenOffice 3.4.0 Windows: broken (lines become diagonal, same as 3.3.0 Linux 64-bit above; regression confirmed)

So this is a regression, at least on Windows, and it used to work correctly until 3.4.0-beta.
Comment 7 papayes 2013-01-21 10:17:01 UTC
hello,
Also with dates on the X Axis on graph
Example File .ods : http://forum.openoffice.org/fr/forum/download/file.php?id=53013

1. Data and graph on the Sheet1:
the copy and paste of the diagram gives a result identical to the one that we obtain with the versions FR “Feuille1”!
No column and no values display in the paste.
Issue indicated for the version FR but which finally affects US also!.
http://forum.openoffice.org/fr/forum/download/file.php?id=53014&mode=view

2. Data and graph on the Sheet2 :
the copy and paste of the diagram modifies the Dates YYYY of the data on JJ/MM/1905
http://forum.openoffice.org/fr/forum/download/file.php?id=53015&mode=view

Bypassing :
Edit graph > Edit the X Axis > Format Axis... > Numbers > To Shoot Source Format > Format Code : Standard > OK
Comment 8 papayes 2013-06-08 13:00:04 UTC
Created attachment 80801 [details]
paste the chart of banaphone on a new calc
Comment 9 papayes 2013-06-08 13:02:06 UTC
(In reply to papayes from comment #8)
> Created attachment 80801 [details]
> paste the chart of banaphone on a new calc

The issue occurs in AOO 400m2 Rev 1489073 2013-06-03 (US)

tested with WIN 8 PRO and Mac Os X 10.8.3
Comment 10 jsc 2013-06-24 12:14:32 UTC
set showstopper flag
Comment 11 Armin Le Grand 2013-06-24 16:37:58 UTC
ALG: Taking a look, preparing some libs
Comment 12 Armin Le Grand 2013-06-25 09:20:18 UTC
ALG: Different versions, different stuff.
Symphony still has #118840#, does not clone data, so correctly in same chart, but loses data in different document target. OOo3.3 does the same. OOo2.2 loses data after activating the chart, ranges are lost, copy/paste locally loses rest, to different document target copies parts, but also wrong.
What should happen is that the copy-command makes a complete clone of the chart data to a local table. Taking a deeper look.
Comment 13 Armin Le Grand 2013-06-25 12:44:35 UTC
ALG: Debugging chart XML in/export. Export writes full dada (1..7, 7x12, 7x13), but import only reads (1..3, 3x12, 3x13). Investigating why this happens...
Comment 14 Armin Le Grand 2013-06-25 14:05:52 UTC
ALG: May still have to do with #118840#; there, the data for the table is forced to be added, before only the ranges were on board. Thus, this chart load error may be old, but never triggered before. Checking by temporarily removing that change...
Comment 15 Armin Le Grand 2013-06-25 14:20:21 UTC
ALG: As expected: With #118840# removed it works as long as the sheet is called 'Sheet1', other sheet names or pasting to new calc looses data. Thus indeed this task maybe old but uncovered by fixing #118840#.
Comment 16 Armin Le Grand 2013-06-27 10:56:37 UTC
ALG: Changed in activated original chart in 'Data Ranges' from 'Data series in rows' to 'Data series in columns' and all works well, all data gets copied as expected. This may be a good hint: exchanging rows/colums leads to loading three instead of seven data points per row. Also the display looks similar (from the trend) as the original error. Thus, this maybe an old chart load error.
Comment 17 Armin Le Grand 2013-06-27 12:33:07 UTC
ALG: Setting a breakpoint in chart2/source/tools/InternalData.cxx:148, select chart from original, press CTRL+C -> chart gets saved, reloaded (for getting model/dimensions) and breaks there, all data is there. Going to another calc and pasting -> breaks there, only some data is there when loading the same chart.
Comment 18 Armin Le Grand 2013-06-27 15:28:07 UTC
ALG: Debugged the chart lifetimes and the load/save cycles.
- Load bugdoc is the first load of instance (a)
- CTRL-C: save (a), create (b), load in (b) -> load in (b) seems okay
- CTRL-P: save (b), create (c), load in (c) -> load in (c) has row/column flipped

Has to do with InternalDataProvider's member m_bDataInColumns which is true by default. Forcing it to false in debugger makes the roundtrip work, so something is going wrong here.
Comment 19 Armin Le Grand 2013-06-27 16:34:57 UTC
ALG:

At initial load: ::com::sun::star::chart::ChartDataRowSource gets initialized to ChartDataRowSource_COLUMNS from SchXMLPlotAreaContext constructor. Then changed to ChartDataRowSource_ROWS from SvXMLImportPropertyMapper from XMLShapeStyleContext which seems okay.

At copying: In SchXMLExportHelper_Impl::exportTable the call to xChartDoc->getData() creates an InternalDataProvider. IN the constructor the call to DataSourceHelper::detectRangeSegmentation changes the m_bDataInColumns from the default true to false (correct). The createInternalDataProvider helper also copies the data, but creates four lines in this case, see lcl_internalizeSeries and the @todo comment there.
The value of bHasOwnData in SchXMLExportHelper_Impl::exportTable() is no longer correct (?). The call lcl_getDataForLocalTable creates two further InternalDataProviders using ChartDataWrapper inside lcl_getDataForLocalTable for the two accesses to xAnyDescriptionAccess, this cannot be wanted (?). Have to check InternalDataProvider lifetimes...
Comment 20 Armin Le Grand 2013-06-27 16:46:23 UTC
ALG: Lifetime is okay, but creating three temporary InternalDataProvider for export seems not effective.
Still in copy, but now to import: the constructed InternalDataProvider does *not* change the internal m_bDataInColumns to false in DataSourceHelper::detectRangeSegmentation due to this bool not yet set at the ChartModel. This may have to do with meDataRowSource member of SchXMLChartContext, need to see where it changes.
Comment 21 Armin Le Grand 2013-06-27 17:00:10 UTC
ALG: It changes in SchXMLPlotAreaContext, member is mrDataRowSource, reference handed over as 12th parameter. Thus it gets changed at SchXMLChartContext before the InternalDataProvider is constructed, but is not yet set at the imported ChartModel. That's why it gets not correctly set in the InternalDataProvider. When doing this handish in this one situation, it works.
Need to find the place and time to set the changed meDataRowSource at ChartModel...
Comment 22 Andre 2013-06-28 08:45:21 UTC
@Armin: You seem to be working on this bug.  Can you take ownership as well?
Comment 23 Armin Le Grand 2013-06-28 10:13:14 UTC
ALG: Yes, grepping...
Comment 24 Armin Le Grand 2013-06-28 11:43:56 UTC
ALG: It looked like close to a solution, but it is not. The value is set in SchXMLPlotAreaContext::StartElement at the right place, but the construction of InternalDataProvider bases it's decision *not* on getting the value from the chart, but from taking a look at chart2::data::XDataSource created in DataSourceHelper::pressUsedDataIntoRectangularFormat (see DataSourceHelper::detectRangeSegmentation). At that time (we are in import) there are no ranges and the default for columns is the result.
Comment 25 Armin Le Grand 2013-06-28 14:59:05 UTC
ALG: Looking for a possibility to set/receive a default value at ChartModel for the call to createInternalDataProvider, so that when no ranges are there this can be used and not simply the column default value.
Comment 26 Armin Le Grand 2013-06-28 16:47:36 UTC
ALG: Finally, I have a first working solution. Class InternalDataProvider uses no longer a fixed default for m_bDataInColumns but allows handing over one in the constructor. It gets used when there is internally no data yet. It gets feded from ChartModelHelper::createInternalDataProvider which uses the UNO API calls to get the boolean property "DataRowSource" from the model data (chart2::XChartDocument -> chart::XChartDocument -> chart::XDiagram -> beans::XPropertySet). This works since it is set already at load time.
I need to check this solution with some other use cases. One strange effect is that the chart data is 'flipped' from the original as if 'data series in rows' was changed to 'Data series in colums', complete with adaption of all ranges. This may be wanted, but I do not know where this is done internally.
Comment 27 Armin Le Grand 2013-07-01 09:12:00 UTC
ALG: Doing some more tests. Ony charts with 'Data series in rows' should be affected (which is not the default). Created each chart type once, copy/pasted to other doc, save/load cycle, copy/paste to other app, looks good.
Comment 28 SVN Robot 2013-07-01 10:46:49 UTC
"alg" committed SVN revision 1498356 into trunk:
i120559 Corrected load for charts without RangeString bu twith local row-orie...
Comment 29 Armin Le Grand 2013-07-01 10:50:42 UTC
ALG: Comitted, done.
Comment 30 fanyuzhen 2013-07-05 06:58:01 UTC
The latest build I get is AOO 4.0 r1496831, wait for revision 1498356 or higher for verification
Comment 31 fanyuzhen 2013-07-09 07:32:14 UTC
Created attachment 81039 [details]
paste the chart of banaphone on a new calc with 4.0.0_r1499347
Comment 32 fanyuzhen 2013-07-09 07:57:22 UTC
I checked with 4.0 revision 1499347, I still see the problem when paste in a new Calc

Steps:
1) Open the test document by bananaphone103
2) Right-click the chart, then Copy
3) Paste in the same document: the pasted chart is identical to the original one
4) Paste in a new Calc document: the pasted chart differs from the original one (no column data, and the legend differs from the original one )
please see attachment "paste the chart of banaphone on a new calc_4.0.0_r1499347.png"

I experience the same problem in 3.4.1.
Comment 33 fanyuzhen 2013-07-09 07:57:22 UTC
I checked with 4.0 revision 1499347, I still see the problem when paste in a new Calc

Steps:
1) Open the test document by bananaphone103
2) Right-click the chart, then Copy
3) Paste in the same document: the pasted chart is identical to the original one
4) Paste in a new Calc document: the pasted chart differs from the original one (no column data, and the legend differs from the original one )
please see attachment "paste the chart of banaphone on a new calc_4.0.0_r1499347.png"

I experience the same problem in 3.4.1.
Comment 34 fanyuzhen 2013-07-09 07:57:26 UTC
I checked with 4.0 revision 1499347, I still see the problem when paste in a new Calc

Steps:
1) Open the test document by bananaphone103
2) Right-click the chart, then Copy
3) Paste in the same document: the pasted chart is identical to the original one
4) Paste in a new Calc document: the pasted chart differs from the original one (no column data, and the legend differs from the original one )
please see attachment "paste the chart of banaphone on a new calc_4.0.0_r1499347.png"

I experience the same problem in 3.4.1.
Comment 35 Armin Le Grand 2013-07-09 10:00:36 UTC
ALG: @fanyuzhen: Please recheck. I also checked with rev 1499347 (the last snapshot build) german version, win7, original bugdoc. All worked well. I get the chart as expected with data and legend in a new calc, following your description. Maybe you are doing something different, e.g. hopw do you paste/copy? Use context menu? Use shortcuts? If you still can reproduce this error, give a *very* detailded step-by-step description, please.
Comment 36 Armin Le Grand 2013-07-09 10:59:18 UTC
ALG: Also checked on mac with rev 1499347, works as expected.
Comment 37 jsc 2013-07-10 08:55:40 UTC
I checked it as well on Mac and everything works as expected

Set the issue back to fixed, please verify