Browse Source

feat(lib): improve type safety for color and sub category

pull/6491/head
KenTandrian 4 weeks ago
parent
commit
2cbe175803
  1. 6
      libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts

6
libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts

@ -278,13 +278,15 @@ export class GfPortfolioProportionChartComponent
Object.keys(item.subCategory ?? {}).forEach((subCategory) => { Object.keys(item.subCategory ?? {}).forEach((subCategory) => {
if (item.name === UNKNOWN_KEY) { if (item.name === UNKNOWN_KEY) {
backgroundColorSubCategory.push(item.color); backgroundColorSubCategory.push(item.color ?? '');
} else { } else {
backgroundColorSubCategory.push( backgroundColorSubCategory.push(
Color(item.color).lighten(lightnessRatio).hex() Color(item.color).lighten(lightnessRatio).hex()
); );
} }
dataSubCategory.push(item.subCategory[subCategory].value.toNumber()); dataSubCategory.push(
item.subCategory?.[subCategory].value.toNumber() ?? 0
);
labelSubCategory.push(subCategory); labelSubCategory.push(subCategory);
lightnessRatio += 0.1; lightnessRatio += 0.1;

Loading…
Cancel
Save