Bug 499211 - Reports: show balance button displays an incorrect chart when pressed from the investment view
Summary: Reports: show balance button displays an incorrect chart when pressed from th...
Status: CONFIRMED
Alias: None
Product: kmymoney
Classification: Applications
Component: reports (show other bugs)
Version: 5.1.3
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-27 19:04 UTC by jesse
Modified: 2025-02-03 17:32 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Screenshot showing an issue (20.77 KB, image/png)
2025-01-29 19:14 UTC, Ralf Habacker
Details
Difference of commit 37f3247d771dbb (49.85 KB, application/pdf)
2025-01-31 16:14 UTC, Thomas Baumgart
Details
test file (18.41 KB, text/xml)
2025-01-31 17:52 UTC, Ralf Habacker
Details
test file (update) (19.39 KB, text/xml)
2025-01-31 18:01 UTC, Ralf Habacker
Details
Screenshot of "Net Worth Graph (Customized)" using mostly the same report config (22.93 KB, image/png)
2025-01-31 18:02 UTC, Ralf Habacker
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jesse 2025-01-27 19:04:11 UTC
SUMMARY
When you select an investment, like a stock, and click on the show chart button, a graph will display. However the chart is incorrect. 


STEPS TO REPRODUCE
1. Open a KMY file with investments
2. Go to Investment view
3. Select an investment such as a stock
4. On the top bar, click on the Show Chart button 
5. Save a screenshot of the chart. 
6. Go to the reports section
7. Open the Investment Worth Graph
8. Open the configuration for the report. 
9. Remove all the accounts selected. 
10. Select only the security/investment account you used in the beginning. 
11. Set the time date range to All Dates. 
12. See the chart 


OBSERVED RESULT
The chart from the Show Chart button is different from the Investment report for the same security. 

EXPECTED RESULT
The charts should be the same assuming the configurations are the same. 

SOFTWARE/OS VERSIONS
Windows:  N/A
macOS:  N/A
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: Fedora  Gnome 41
KMyMoney:  5.1.3-eef04f1
KDE Plasma Version: n/a
KDE Frameworks Version: Version 5.115.0
Qt Version: Version 5.15.12 (built against 5.15.12)



ADDITIONAL INFORMATION
Maybe related: https://bugs.kde.org/show_bug.cgi?id=414932
Comment 1 Ralf Habacker 2025-01-27 22:45:29 UTC
(In reply to jesse from comment #0)
> When you select an investment, like a stock, and click on the show chart
> button, a graph will display. However the chart is incorrect. 

There is a problem collecting the report data when forecast values are included. If I comment out this call

// reportCfg.setIncludingForecast(true);

at  https://invent.kde.org/office/kmymoney/-/blob/master/kmymoney/plugins/views/reports/kbalancechartdlg.cpp#L89 I see the graph until today.
Comment 2 Ralf Habacker 2025-01-28 06:31:09 UTC
Git commit 1688458e4f5ff2d19e5198fb57aa6b23715463e7 by Ralf Habacker.
Committed on 28/01/2025 at 06:30.
Pushed by habacker into branch 'master'.

Fixed bug when displaying the account balance history

There is a problem with the display of the relevant report
if forecast data is included. These have therefore been
excluded and the report area adjusted.

M  +6    -1    kmymoney/plugins/views/reports/kbalancechartdlg.cpp

https://invent.kde.org/office/kmymoney/-/commit/1688458e4f5ff2d19e5198fb57aa6b23715463e7
Comment 3 Ralf Habacker 2025-01-29 19:14:01 UTC
Created attachment 177798 [details]
Screenshot showing an issue

With version 5.1.3, the problem shown in the attached screenshot can be reproduced, which occurs when the displayed dialog has a width of > 261 pixels. 

An additional workaround is to set in the source code

     reportCfg.setColumnsAreDays(false);
Comment 4 Ralf Habacker 2025-01-29 22:26:45 UTC
Git commit 37f3247d771dbb5b4fa32891006a52018d6756e7 by Ralf Habacker.
Committed on 29/01/2025 at 22:26.
Pushed by habacker into branch 'master'.

Use a less invasive workaround to display the account balance history

It looks like the amount of data triggers the problem, because if
you set setColumnsAreDays(false), it no longer occurs.

M  +2    -7    kmymoney/plugins/views/reports/kbalancechartdlg.cpp

https://invent.kde.org/office/kmymoney/-/commit/37f3247d771dbb5b4fa32891006a52018d6756e7
Comment 5 Thomas Baumgart 2025-01-31 16:14:22 UTC
Created attachment 177850 [details]
Difference of commit 37f3247d771dbb

I am not so sure if that is a solution: for me it breaks more than it fixes.
Comment 6 Ralf Habacker 2025-01-31 17:20:53 UTC
(In reply to Thomas Baumgart from comment #5)
> I am not so sure if that is a solution: for me it breaks more than it fixes.

With a build of git master and libKChart2-2.8.0 on openSUSE Leap 15.6, what is shown in https://bugs.kde.org/attachment.cgi?id=177798 is constantly reproducible when the width of the dialog exceeds a certain value.
I'm currently not sure if the problem is with kdiagram or KMyMoney, so this was added as a workaround to be able to see anything at all. Do you not have this problem?
Comment 7 Ralf Habacker 2025-01-31 17:40:58 UTC
Git commit c9766314f8760e08510c1d67dc2afde3e9530ab6 by Ralf Habacker.
Committed on 31/01/2025 at 17:40.
Pushed by habacker into branch 'master'.

Another attempt to fix display of the account balance history

Reducing the range to +-2 months seems to be a better solution.
Now daily data can be displayed again. If there is a program-based
way to detect the error case, this could be set dynamically.

M  +2    -1    kmymoney/plugins/views/reports/kbalancechartdlg.cpp

https://invent.kde.org/office/kmymoney/-/commit/c9766314f8760e08510c1d67dc2afde3e9530ab6
Comment 8 Ralf Habacker 2025-01-31 17:52:43 UTC
Created attachment 177856 [details]
test file

Screenshot https://bugs.kde.org/attachment.cgi?id=177798&action=edit can be reproduced with this test file.
Comment 9 Ralf Habacker 2025-01-31 18:01:16 UTC
Created attachment 177858 [details]
test file (update)

- Added Net Worth Graph (Customized) using the same report config
Comment 10 Ralf Habacker 2025-01-31 18:02:49 UTC
Created attachment 177859 [details]
Screenshot of "Net Worth Graph (Customized)" using mostly the same report config
Comment 11 Ralf Habacker 2025-02-01 09:08:15 UTC
Git commit 846e3fc0bc3e1f20a9c2f2d2fa332e20f520a1ed by Ralf Habacker.
Committed on 01/02/2025 at 09:08.
Pushed by habacker into branch 'master'.

Fix incorrect display in the balance history report

In this specific case, the values were between 120 and 240, which,
according to current knowledge, is not handled correctly by
kdiagram above a certain diagram width.

In this case, an additional vertical distance of 10 was added
in order to obtain an entry above the displayed values on the
vertical axis for smaller values.
FIXED-IN:5.2

M  +5    -1    kmymoney/plugins/views/reports/core/kreportchartview.cpp
M  +0    -1    kmymoney/plugins/views/reports/kbalancechartdlg.cpp

https://invent.kde.org/office/kmymoney/-/commit/846e3fc0bc3e1f20a9c2f2d2fa332e20f520a1ed
Comment 12 Thomas Baumgart 2025-02-02 11:00:37 UTC
Git commit fae9b83fdc80d478ae1ad96ba7a72b97e7a93052 by Thomas Baumgart.
Committed on 02/02/2025 at 11:00.
Pushed by tbaumgart into branch 'master'.

Fix problem with balance chart

Setup the report configuration to display balance/value charts for
regular, stock and investment accounts.
FIXED-IN: 5.2

M  +1    -5    kmymoney/plugins/views/reports/core/kreportchartview.cpp
M  +41   -18   kmymoney/plugins/views/reports/kbalancechartdlg.cpp

https://invent.kde.org/office/kmymoney/-/commit/fae9b83fdc80d478ae1ad96ba7a72b97e7a93052
Comment 13 Ralf Habacker 2025-02-02 14:22:27 UTC
Git commit 89e952ba427f763d5d8657e3bb57c8770edf224e by Ralf Habacker.
Committed on 02/02/2025 at 14:22.
Pushed by habacker into branch 'master'.

Fix display of vertical axis for investment accounts

M  +2    -0    kmymoney/plugins/views/reports/core/kreportchartview.cpp

https://invent.kde.org/office/kmymoney/-/commit/89e952ba427f763d5d8657e3bb57c8770edf224e
Comment 14 Ralf Habacker 2025-02-02 14:22:29 UTC
Git commit e0619ed69bcdefc2b0bc88829510ccc6feeca1a8 by Ralf Habacker.
Committed on 02/02/2025 at 14:22.
Pushed by habacker into branch 'master'.

Add missing report configuration to balance/value chart

Users may want to customize the settings of the diagram.

M  +26   -1    kmymoney/plugins/views/reports/kbalancechartdlg.cpp
M  +3    -0    kmymoney/plugins/views/reports/kbalancechartdlg.h
M  +2    -44   kmymoney/plugins/views/reports/kreportconfigurationfilterdlg.cpp
M  +66   -4    kmymoney/plugins/views/reports/reporttabimpl.cpp
M  +3    -0    kmymoney/plugins/views/reports/reporttabimpl.h

https://invent.kde.org/office/kmymoney/-/commit/e0619ed69bcdefc2b0bc88829510ccc6feeca1a8
Comment 15 Ralf Habacker 2025-02-02 14:22:35 UTC
Git commit fd1ca8a777c409582991aa82913197fb57a125f9 by Ralf Habacker.
Committed on 02/02/2025 at 14:22.
Pushed by habacker into branch 'master'.

Cleanup of implementation of the balance history report

The specific report view has been moved into a separate class named
BalanceChartView as preparation for further commits.

M  +105  -103  kmymoney/plugins/views/reports/kbalancechartdlg.cpp
M  +4    -5    kmymoney/plugins/views/reports/kbalancechartdlg.h

https://invent.kde.org/office/kmymoney/-/commit/fd1ca8a777c409582991aa82913197fb57a125f9
Comment 16 Ralf Habacker 2025-02-02 18:55:44 UTC
Git commit 3ace08611850d2cb73c1cfb8cca825a72a60c330 by Ralf Habacker.
Committed on 02/02/2025 at 18:55.
Pushed by habacker into branch 'master'.

Exclude unsupported configure options in balance history report

The diagram types 'StackedBar' and 'Ring' do not produce any meaningful
diagram outputs and the function “Display outputs downwards” leads to
an application freeze and is therefore hidden.

M  +3    -0    kmymoney/plugins/views/reports/kbalancechartdlg.cpp
M  +10   -1    kmymoney/plugins/views/reports/reporttabimpl.cpp
M  +4    -0    kmymoney/plugins/views/reports/reporttabimpl.h

https://invent.kde.org/office/kmymoney/-/commit/3ace08611850d2cb73c1cfb8cca825a72a60c330
Comment 17 Thomas Baumgart 2025-02-02 20:40:13 UTC
Git commit 7a728eb754296c10f7cc6d21a965511ade7f76e6 by Thomas Baumgart.
Committed on 02/02/2025 at 20:39.
Pushed by tbaumgart into branch 'master'.

Fix horizontal limit markers in the balance chart

This fixes the display of the limit markers and an optional zero line in
the balance chart dialog.

M  +8    -7    kmymoney/plugins/views/reports/core/kreportchartview.cpp
M  +0    -16   kmymoney/plugins/views/reports/core/kreportchartview.h
M  +65   -19   kmymoney/plugins/views/reports/kbalancechartdlg.cpp

https://invent.kde.org/office/kmymoney/-/commit/7a728eb754296c10f7cc6d21a965511ade7f76e6
Comment 18 jesse 2025-02-03 17:32:54 UTC
I really like the new show chart button and the way it displays. 

My only question, can you make the configure report button, also allow the user to select a start date for the chart?

Extra thoughts: 
If the user select more than 12 months back, then make the tick marks monthly, if the user selects 6 months back, make the tick marks weekly. If the user selects 3 months or less, make the tick marks daily. 

I know there are other items being worked. We can leave this as a wish list for another time also. 

For now, the changes you guys made, seem to be working well! Thank you!