Skip to content

Commit

Permalink
handle case where group might be empty
Browse files Browse the repository at this point in the history
If the user has only equity, then rating category might be completely empty.
  • Loading branch information
ananthakumaran committed Apr 9, 2023
1 parent 7f7072c commit d4669a3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/portfolio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ export function renderPortfolioBreakdown(
.sort()
.value();

const z = generateColorScheme(groups);

const legendg = svg.append("g");
const aggregatesg = svg.append("g");

Expand Down Expand Up @@ -99,6 +97,11 @@ export function renderPortfolioBreakdown(

let rendered = false;

let z: d3.ScaleOrdinal<string, string, never> = null;
if (!_.isEmpty(groups)) {
z = generateColorScheme(groups);
}

return (portfolioAggregates: PortfolioAggregate[], color: d3.ScaleOrdinal<string, string>) => {
if (_.isEmpty(portfolioAggregates)) {
treemap.style("display", "none");
Expand Down

0 comments on commit d4669a3

Please sign in to comment.