diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b7271353..3834e1cc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Improved the portfolio evolution chart (ignore first item) - Improved the accounts import by handling the platform ### Fixed diff --git a/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts b/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts index ae60a5e2a..74371da9d 100644 --- a/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts +++ b/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts @@ -308,18 +308,24 @@ export class AnalysisPageComponent implements OnDestroy, OnInit { this.performanceDataItems = []; this.performanceDataItemsInPercentage = []; - for (const { - date, - netPerformanceInPercentage, - totalInvestment, - value, - valueInPercentage - } of chart) { - this.investments.push({ date, investment: totalInvestment }); - this.performanceDataItems.push({ + for (const [ + index, + { date, - value: isNumber(value) ? value : valueInPercentage - }); + netPerformanceInPercentage, + totalInvestment, + value, + valueInPercentage + } + ] of chart.entries()) { + if (index > 0 || this.user?.settings?.dateRange === 'max') { + // Ignore first item where value is 0 + this.investments.push({ date, investment: totalInvestment }); + this.performanceDataItems.push({ + date, + value: isNumber(value) ? value : valueInPercentage + }); + } this.performanceDataItemsInPercentage.push({ date, value: netPerformanceInPercentage