Relative axis scaling in graph doesn't work with negative values #257

Closed
hsoft opened this Issue Jun 22, 2013 · 6 comments

Projects

None yet

1 participant

@hsoft
Owner
hsoft commented Jun 22, 2013

From #122

the Net Worth graph doesn't always adjust the vertical axis properly.
If the entire graph is positive, then the zero line is shifted down (off the graph) to let you see the "detail" in small variations (e.g. if the net worth ranges from 34,100 to 35,600 the vertical axis will run from 34,000 to 36,000).
But it doesn't do this when the entire graph is negative (e.g. if the net worth ranges from -34,100 to -35,600 the vertical axis runs from 0 to -36,000), so with a loan/mortgage where monthly changes are maybe 1% of the debt, its very hard to see what the graph is doing.

@hsoft hsoft closed this Jun 22, 2013
@hsoft
Owner
hsoft commented Jun 22, 2013

If you've not already done the fix, it's presumably just a matter of removing the outer max() from line 66 of core/gui/balance_graph.py:

        ymax = max(0, max(point[1] for point in self._data))

becomes

        ymax = max(point[1] for point in self._data)

I've not had time to get all the dependencies together to get it building yet, so can't yet test to see if it makes sense or breaks any tests...

@hsoft
Owner
hsoft commented Jun 22, 2013

Yeah, it's probably a very simple fix. But what I have to do (which I haven't done yet) is to check whether there was a reason for this axis behavior.

@hsoft
Owner
hsoft commented Jun 22, 2013

(if there's a reason, there's a test for it, so yeah, it's a matter of making the fix and see if it breaks any test)

@hsoft
Owner
hsoft commented Jun 22, 2013

I could reproduce the bug. In a new file, put a "negative" transaction for 10k and the scale of the NW graph will go from 0 to -20000. Make it "positive" and the scale goes from 9900 to 10100.

@hsoft
Owner
hsoft commented Jun 22, 2013

(from [8a89761616c0]) [#257 state:fixed] Made Y axis scaling work for negative values in balance graph.
https://bitbucket.org/hsoft/moneyguru/changeset/8a89761616c0/

@hsoft
Owner
hsoft commented Jun 22, 2013

@frog: It didn't break any test, and yes, it was this line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment