Kmymoney reporting graphs with expenses shown as negative
ClosedPublic

Authored by michaelkiefer on Nov 27 2018, 10:38 PM.

Details

Reviewers
tbaumgart
Group Reviewers
KMyMoney
Summary

In order to compare your incomes and expenses, you can use a stacked bar chart. However, usually the result looks like this


Incomes and expenses both make the stacked bar rise, which I find quite counter-intuitive.

For better visualizing this, I created a toggle switch that allows you to plot your expenses as negatively-stacked bars:


The result looks like this:

Incomes go upwards and expenses downwards.

By comparing the bars, you have a visual feeling on

  • how much you earned or lost during a month
  • which of your categories contributed to what amount
  • how these contributions changed over time

As I find this type of report quite useful, I added one in the default reports:

Diff Detail

Repository
R261 KMyMoney
Branch
downwardsbars (branched from master)
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 5561
Build 5579: arc lint + arc unit
michaelkiefer requested review of this revision.Nov 27 2018, 10:38 PM
michaelkiefer created this revision.
michaelkiefer created this object with edit policy "KMyMoney (Project)".
michaelkiefer retitled this revision from Reporting graphs with expenses shown as negative to Kmymoney reporting graphs with expenses shown as negative.Nov 27 2018, 10:40 PM

In general a good idea and a cool addition to the application.

kmymoney/mymoney/mymoneyreport.h
6

Please provide a valid and working mail address and replace it in all instances of this change. Otherwise, we cannot accept this patch (KDE policy)

<mlkiefer@users.noreply.github.com>: Host or domain name not found. Name
   service error for name=users.noreply.github.com type=A: Host not found
kmymoney/plugins/views/reports/core/kreportchartview.cpp
297

why not

const bool invertValue = config.isNegExpenses() && (*it_outergroup).m_inverted)
358

same as above

395

one more

686

Why not

double value = gridRow.at(i).toDouble();
if (invertValue)
  value = -value;
kmymoney/plugins/views/reports/kreportconfigurationfilterdlg.cpp
397

Better

d->m_tabChart->setNegExpenses(state == Qt::Checked);
kmymoney/plugins/views/reports/reporttabimpl.cpp
133

Better: 'so disable it' because it is not hidden

kmymoney/plugins/xmlhelper/xmlstoragehelper.cpp
697

If I understand this right, the default will turn the show negative expenses downwards to on. This is *not* backward compatible.

included Thomas' suggestions

michaelkiefer marked 8 inline comments as done.Nov 29 2018, 6:10 PM

Thanks for your suggestions! I hope, I included them correctly.
First time contributing to KDE after 21 years of using it ;-)

Added your suggestions (and fixed the patch)

tbaumgart accepted this revision.Nov 30 2018, 7:41 PM

In case you don't have write access let me know.

This revision is now accepted and ready to land.Nov 30 2018, 7:41 PM
michaelkiefer closed this revision.Nov 30 2018, 8:10 PM
tbaumgart reopened this revision.Nov 30 2018, 9:05 PM
This revision is now accepted and ready to land.Nov 30 2018, 9:05 PM
tbaumgart closed this revision.Nov 30 2018, 9:52 PM

Closed manually after I landed the change manually as dffdf76750f74ad6e8741abe5ed4b7380f9b65e3