Bug 37407 - Calc XY (scatter) chart Sort by x values has wrong x,y in tooltip
Summary: Calc XY (scatter) chart Sort by x values has wrong x,y in tooltip
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Chart (show other bugs)
Version:
(earliest affected)
3.3.2 release
Hardware: x86 (IA32) All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Chart
  Show dependency treegraph
 
Reported: 2011-05-20 07:44 UTC by Christopher M. Penalver
Modified: 2020-11-15 11:05 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
xyscatterbug.ods (14.47 KB, application/vnd.oasis.opendocument.spreadsheet)
2011-05-20 07:44 UTC, Christopher M. Penalver
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher M. Penalver 2011-05-20 07:44:26 UTC
Created attachment 46954 [details]
xyscatterbug.ods

Downstream bug may be found at:
https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/258705

OOo bug may be found at:
http://openoffice.org/bugzilla/show_bug.cgi?id=95508

1) lsb_release -rd
Description: Ubuntu 11.04
Release: 11.04

2) LibreOffice:
apt-cache policy libreoffice-calc
libreoffice-calc:
  Installed: 1:3.3.2-1ubuntu5
  Candidate: 1:3.3.2-1ubuntu5
  Version table:
 *** 1:3.3.2-1ubuntu5 0
        500 http://us.archive.ubuntu.com/ubuntu/ natty-updates/main i386 Packages
        500 http://us.archive.ubuntu.com/ubuntu/ natty-proposed/main i386 Packages
        100 /var/lib/dpkg/status
     1:3.3.2-1ubuntu4 0
        500 http://us.archive.ubuntu.com/ubuntu/ natty/main i386 Packages

3) What is expected to happen in Calc via the Terminal:

cd ~/Desktop && wget https://bugs.launchpad.net/ubuntu/+source/openoffice.org/+bug/258705/+attachment/403067/+files/xyscatterbug.ods && localc -nologo xyscatterbug.ods

double click the XY (Scatter), sorted by X values chart and hover the mouse icon over a data point, the pop up notes the correct X,Y value.

4) What happens instead is it does not. The pop-up is using the data values top to bottom, to display the data point values from left to right.
Comment 1 Björn Michaelsen 2011-12-23 12:02:48 UTC Comment hidden (obsolete)
Comment 2 Christopher M. Penalver 2012-01-04 00:52:03 UTC
Reproducible in:
LOdev 3.5.0beta2 
Build ID: 8589e48-760cc4d-f39cf3d-1b2857e-60db978
Microsoft Windows Vista Business 6.0.6002 Service Pack 2 Build 6002
Comment 3 ign_christian 2013-05-23 15:32:59 UTC
Hi Christopher

I can confirm that using your explanation I can reproducible that problem. But if I build XY chart from scratch using your data it's not happen.

Could you confirm using LO 4.0.3.3 whether tooltips still show wrong info?
Comment 4 Christopher M. Penalver 2013-05-25 12:53:19 UTC
ign_christian, thank you for your comments. Using the attachment noted in the Description https://bugs.freedesktop.org/attachment.cgi?id=46954 one may open Microsoft Office Professional Plus 2010 Excel Version 14.0.6023.1000 (32-bit), hover over the noted data point, and it displays the correct tooltip information. For future triaging, let the focus be on the noted attachment.

Problem in Description reproducible in:
Microsoft Windows Vista Business x86 6.0.6002 Service Pack 2 Build 6002
Version: 4.2.0.0.alpha0+
Build ID: 979def88090633bfee0e0445b19999a1dac71ed
Comment 5 ign_christian 2013-06-13 08:17:31 UTC
I was using that attachment. Just wondering why creating new XY chart on that attachment generates correct result?
Comment 6 Julien Nabet 2014-08-24 07:26:37 UTC
On pc Debian x86-64 with master sources updated yesterday, I could reproduce this.

If I create from the file attached a new graphic, I could reproduce too the problem.
(ign_christian: had you checked "Sort by X Values"?)
Comment 7 ign_christian 2014-08-24 08:25:51 UTC
You're right Julien, reproducible with "Sort by X values" checked with LO 4.3.1.1. Looks like I forgot checked that in previous testing :)

Anyway I don't understand the purpose of "Sort by X values" in XY chart. It doesn't make any difference in chart.
Comment 8 Julien Nabet 2014-08-24 08:46:30 UTC
Thank you ign_christian for your feedback. Great (in a way) you could reproduce it too :)

Just some notes.
Searching "Sort by X Values" with keyId language gives this:
https://translations.documentfoundation.org/fr/translate/#search=CFYgL&sfields=source,target,notes
=> tp_ChartType.ui

http://opengrok.libreoffice.org/search?q=tp_ChartType.ui&project=core&defs=&refs=&path=&hist= gives:
- chart2/source/controller/dialogs/tp_PointGeometry.cxx
- chart2/source/controller/dialogs/tp_ChartType.cxx
From the second one, searching "sort" keyword gives mpCB_XValueSorting, itself linked to "bSortByXValues" member of ChartTypeParameter, see http://opengrok.libreoffice.org/xref/core/chart2/source/controller/dialogs/ChartTypeDialogController.hxx#81
Comment 9 Julien Nabet 2014-08-24 21:04:11 UTC
bSortByXValues brings there:
http://opengrok.libreoffice.org/xref/core/chart2/source/view/main/ChartView.cxx#784

Searching about how is defined data point gives this:
STR_TIP_DATAPOINT which leads there:
http://opengrok.libreoffice.org/xref/core/chart2/source/controller/dialogs/ObjectNameProvider.cxx#498

But then, I'm a bit stuck.

Kohei/Markus/Eike: any idea here?
Comment 10 QA Administrators 2015-09-04 02:48:12 UTC Comment hidden (obsolete)
Comment 11 Buovjaga 2015-11-18 11:57:46 UTC
Confirmed with attachment.

Win 7 Pro 64-bit Version: 5.1.0.0.alpha1+
Build ID: b216cc1b8096eb60c27f67e8c27b7cd756c75e38
TinderBox: Win-x86@62-merge-TDF, Branch:MASTER, Time: 2015-11-12_00:06:20
Locale: fi-FI (fi_FI)
Comment 12 QA Administrators 2017-01-03 19:36:17 UTC Comment hidden (obsolete)
Comment 13 QA Administrators 2019-12-03 13:57:09 UTC Comment hidden (obsolete)
Comment 14 Leyan 2020-11-14 22:23:26 UTC
The bug is still present in version: 7.1.0.0.alpha1+

I had a look, it is due to the "sort by X value" being done in the view part (in VDataSeries::doSortByXValues()) without updating the model data, while the tooltip text is generated by lcl_getDataPointValueText in ObjectNameProvider.cxx in the controller part, which has access to the model data, but not the view data and the VDataSeries correctly sorted.

Does it mean the sort should be done elsewhere and apply to the model data as well?
Comment 15 Julien Nabet 2020-11-15 09:15:21 UTC
(In reply to Leyan from comment #14)
> The bug is still present in version: 7.1.0.0.alpha1+
> 
> I had a look, it is due to the "sort by X value" being done in the view part
> (in VDataSeries::doSortByXValues()) without updating the model data, while
> the tooltip text is generated by lcl_getDataPointValueText in
> ObjectNameProvider.cxx in the controller part, which has access to the model
> data, but not the view data and the VDataSeries correctly sorted.
> 
> Does it mean the sort should be done elsewhere and apply to the model data
> as well?

Good job! Would you be interested in proposing a patch?
Indeed, it seems you made most of the way for this since I suppose you:
- downloaded LO sources
- built it
- analyzed the code + found root cause
- began to think about a fix
So the only things to do would be:
- provide license statement (just an email on LO dev)
- create gerrit account
- submit a patch
If yes, here's a link to take a look:
https://wiki.documentfoundation.org/Development/GetInvolved
Comment 16 Leyan 2020-11-15 11:00:54 UTC
I do have a Gerrit account and a license statement, but it seems you are missing one tiny little step, which is to actually write the correction. I haven't done it.

It is probably not very hard for someone familiar with the code, but I am not sure how to go about it, hence the question.
Comment 17 Julien Nabet 2020-11-15 11:05:06 UTC
(In reply to Leyan from comment #16)
> ...
> It is probably not very hard for someone familiar with the code, but I am
> not sure how to go about it, hence the question.

Indeed, I should have taken a look at git history, I would have seen https://cgit.freedesktop.org/libreoffice/core/commit/?id=c1b96424b65aed2401a3e86d53a48cc12284de7c.