Browse Source
Merge pull request #4 from gizmodus/feature/chart-step-size
Reduce the step size of recent dates
pull/3393/head
gizmodus
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
10 additions and
0 deletions
-
apps/api/src/app/portfolio/calculator/portfolio-calculator.ts
|
@ -1188,6 +1188,16 @@ export abstract class PortfolioCalculator { |
|
|
chartDateMap[format(date, DATE_FORMAT)] = true; |
|
|
chartDateMap[format(date, DATE_FORMAT)] = true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (step > 1) { |
|
|
|
|
|
// Reduce the step size of recent dates
|
|
|
|
|
|
for (let date of eachDayOfInterval( |
|
|
|
|
|
{ end: endDate, start: subDays(endDate, 90) }, |
|
|
|
|
|
{ step: 1 } |
|
|
|
|
|
)) { |
|
|
|
|
|
chartDateMap[format(date, DATE_FORMAT)] = true; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// Make sure the end date is present
|
|
|
// Make sure the end date is present
|
|
|
chartDateMap[format(endDate, DATE_FORMAT)] = true; |
|
|
chartDateMap[format(endDate, DATE_FORMAT)] = true; |
|
|
|
|
|
|
|
|