From 680b500d1a51a99bba9e302200167816b321facf Mon Sep 17 00:00:00 2001 From: Anantha Kumaran Date: Mon, 15 Jan 2024 19:29:23 +0530 Subject: [PATCH] [cashflow] use appropriate signs when computing y axis domain refer #144 --- src/lib/cash_flow.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib/cash_flow.ts b/src/lib/cash_flow.ts index 346669b7..928784f5 100644 --- a/src/lib/cash_flow.ts +++ b/src/lib/cash_flow.ts @@ -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);