Feature/Improve background color assignment in treemap chart component (#3918)

* Improve background color assignment in treemap chart component

* Update changelog
pull/3895/head^2
Madhab Chandra Sahoo 1 month ago committed by GitHub
parent f8da265f5f
commit 67a147bd96
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Improved the backgrounds of the chart of the holdings tab on the home page (experimental)
- Improved the labels of the chart of the holdings tab on the home page (experimental)
- Refactored the rule thresholds in the _X-ray_ section (experimental)
- Exposed the timeout of the portfolio snapshot computation as an environment variable (`PROCESSOR_PORTFOLIO_SNAPSHOT_COMPUTATION_TIMEOUT`)

@ -91,7 +91,7 @@ export class GfTreemapChartComponent
datasets: [
{
backgroundColor(ctx) {
const annualizedNetPerformancePercentWithCurrencyEffect =
let annualizedNetPerformancePercentWithCurrencyEffect =
getAnnualizedPerformancePercent({
daysInMarket: differenceInDays(
endDate,
@ -105,6 +105,12 @@ export class GfTreemapChartComponent
)
}).toNumber();
// Round to 2 decimal places
annualizedNetPerformancePercentWithCurrencyEffect =
Math.round(
annualizedNetPerformancePercentWithCurrencyEffect * 100
) / 100;
if (
annualizedNetPerformancePercentWithCurrencyEffect >
0.03 * GfTreemapChartComponent.HEAT_MULTIPLIER
@ -123,8 +129,11 @@ export class GfTreemapChartComponent
} else if (annualizedNetPerformancePercentWithCurrencyEffect > 0) {
return green[3];
} else if (
annualizedNetPerformancePercentWithCurrencyEffect === 0
Math.abs(annualizedNetPerformancePercentWithCurrencyEffect) === 0
) {
annualizedNetPerformancePercentWithCurrencyEffect = Math.abs(
annualizedNetPerformancePercentWithCurrencyEffect
);
return gray[3];
} else if (
annualizedNetPerformancePercentWithCurrencyEffect >

Loading…
Cancel
Save