Bug 74549 - Chart doesn't show correct values on X-axis
Summary: Chart doesn't show correct values on X-axis
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Chart (show other bugs)
Version:
(earliest affected)
4.2.0.4 release
Hardware: All All
: high critical
Assignee: Markus Mohrhard
URL:
Whiteboard: target:4.3.0 target:4.2.3
Keywords: regression
: 74965 75711 76087 76860 76969 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-02-05 09:41 UTC by Eneko Lacunza
Modified: 2014-04-07 13:02 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
Simple spreadsheet that demonstrates the bug (40.86 KB, application/vnd.oasis.opendocument.spreadsheet)
2014-02-05 09:41 UTC, Eneko Lacunza
Details
File with Histogram and X-axis date scale as text (53.03 KB, application/vnd.oasis.opendocument.spreadsheet)
2014-02-06 13:35 UTC, GerardF
Details
x axis shows incorrect date information. Should be same as the selected cells (26.28 KB, application/vnd.oasis.opendocument.spreadsheet)
2014-04-01 17:06 UTC, Jaime Carpenter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eneko Lacunza 2014-02-05 09:41:02 UTC
Created attachment 93432 [details]
Simple spreadsheet that demonstrates the bug

We three lines of data, the first are date values and the other two count values (estimated ours - not relevant for the bug).

When creating a chart with first line for X-axis label, graph is good but the labels are not. Seems there is some type of misscalculation.

Please find attached spreadsheet that demonstrates the bug, there are some red-marked data that are not correctly shown in the chart.

ODS file is created with LibreOffice 3.5.7.2 
Build ID: 350m1(Build:2) and it's shown correctly.
Comment 1 Dominique Boutry 2014-02-06 11:10:26 UTC
Hi.

Please how did you manage to have:
- an X-axis showing 5 days per 7 (01-21, 01-24, 01-25... but no 01-22, 01-23)
- based on series which show these 2 days (all 7 days per 7) ?

Thanks
Comment 2 Eneko Lacunza 2014-02-06 11:22:29 UTC
Hi Dominique,

The chart is based directly on spreadsheet data. Date calculus is made 
using B2 as starting date, then dia.lab() function (WORKDAY()) is used 
to calculate next bussiness day.

Spreadsheet show correct dates, but chart does not.
Comment 3 GerardF 2014-02-06 13:19:57 UTC
Reproducible with Version: 4.3.0.0.alpha0+
Build ID: f571104ef38ba9f7f6073e22c2374add7aa73887
TinderBox: Win-x86@39, Branch:master, Time: 2014-01-28_00:11:40
Sorry, don't have 4.2.0 for testing.

All dates in X-axis are offset by 693958 days. Show 0114-01-21 instead of 2014-01-17 for the 1st.

Format scale axis to "date" or "automatic" cure the problem.
It seems that setting date as "text" misinterpret the date.
Comment 4 GerardF 2014-02-06 13:35:39 UTC
Created attachment 93526 [details]
File with Histogram and X-axis date scale as text

Affect Line chart but also Histogram. All charts where you can scale Axis as "Date" or "Text".

It seems that the new date origin is not 31/12/1899 for chart but JC birth... :)
Comment 5 GerardF 2014-02-06 13:38:38 UTC
Raise importance to High/Critical.
I don't know if we should consider this as a blocker/mab as most of users use real date for X-asis and not text category.
Comment 6 Dominique Boutry 2014-02-06 14:50:21 UTC
Results of my experiments:

The data type of X-Axis values is "Text" (and not Date: should it was, you would have seen the saturdays and sundays wihout data).
If you format the X-Axis values with "Number>Default", you see the repesentation of right numeric values (41656, 41659, and so on).
If you format the X-Axis values with "Date>31/12/99", you see "21/01/14, 24/01/14", and so on. The conversion into Date is false, too high by contant 4.

Step to reproduce :
- in a New spreadsheet,
- fill in A1 with 41676, C1 with "=A1" formatted as "Date" : 06/02/14, OK
- fill in A2 with 100, select A1:A2, Insert a Chart, Column-type, "Next", "Data series in rows", "First row as label" then "Finish",
- right click on the 41676 value in X-axis, "Format Axis", then "Date"
- Observe "10/02/14"!
- You have just been stolen 4 days... Quick, quick, close the doors...
Comment 7 Dominique Boutry 2014-02-06 14:51:26 UTC
Similar conclusion... obtained at the same time (Mid-air collision).
Comment 8 GerardF 2014-02-14 15:02:43 UTC
*** Bug 74965 has been marked as a duplicate of this bug. ***
Comment 9 Commit Notification 2014-03-19 03:54:34 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "master":

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

the type in the Any is a util::Date and not a DateTime, fdo#74549



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 10 Markus Mohrhard 2014-03-19 03:58:59 UTC
attachment 93432 [details] worked without a problem in master.

I fixed the issue that I saw with attachment attachment 93526 [details]. Hopefully that fixes also the issue that you see with 93432. Backport request for 4-2 pending in gerrit.

Please test in a daily build that it is really fixed.
Comment 11 Jorendc 2014-03-19 10:12:51 UTC
@Markus: bug 76087 is related/a dupe?

Thanks for fixing :-)!
Comment 12 Commit Notification 2014-03-19 10:27:51 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "libreoffice-4-2":

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

the type in the Any is a util::Date and not a DateTime, fdo#74549


It will be available in LibreOffice 4.2.4.

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 Markus Mohrhard 2014-03-20 00:16:03 UTC
*** Bug 76087 has been marked as a duplicate of this bug. ***
Comment 14 Markus Mohrhard 2014-03-20 00:16:25 UTC
*** Bug 75711 has been marked as a duplicate of this bug. ***
Comment 15 Commit Notification 2014-03-21 11:22:15 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "libreoffice-4-2-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=1b9f2f843723e45c0f5a8899b754f0dab01e5df6&h=libreoffice-4-2-3

the type in the Any is a util::Date and not a DateTime, fdo#74549


It will be available already in LibreOffice 4.2.3.

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 Jorendc 2014-04-01 09:34:05 UTC
*** Bug 76860 has been marked as a duplicate of this bug. ***
Comment 17 Jaime Carpenter 2014-04-01 17:06:49 UTC
Created attachment 96738 [details]
x axis shows incorrect date information.  Should be same as the selected cells
Comment 18 Jorendc 2014-04-03 09:21:01 UTC
*** Bug 76969 has been marked as a duplicate of this bug. ***
Comment 19 Björn Michaelsen 2014-04-04 13:13:36 UTC
Hmm the x-axis label in attachment 96738 [details] still look wrong to me in 4.2.3.2. Is that a different bug, or should this one be reopened?
Comment 20 Eneko Lacunza 2014-04-07 13:01:28 UTC
I see this fixed in Ubuntu PPA 4.2.3rc3, thanks!!