Skip to content

Commit

Permalink
[cashflow] use appropriate signs when computing y axis domain
Browse files Browse the repository at this point in the history
refer #144
  • Loading branch information
ananthakumaran committed Jan 15, 2024
1 parent b2b71df commit 680b500
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/lib/cash_flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,11 @@ export function renderMonthlyFlow(

const renderer = function (cashFlows: CashFlow[]) {
const positions = _.flatMap(cashFlows, (c) => [
c.income,
c.liabilities,
c.expenses + c.tax + c.investment,
c.income + (c.investment < 0 ? -c.investment : 0) + (c.liabilities > 0 ? c.liabilities : 0),
c.expenses +
c.tax +
(c.investment > 0 ? c.investment : 0) +
(c.liabilities < 0 ? -c.liabilities : 0),
c.balance
]);
positions.push(0);
Expand Down

0 comments on commit 680b500

Please sign in to comment.