Skip to content

Commit

Permalink
fix: Properly skip empty groups in Bubble, Pie and Treemap charts
Browse files Browse the repository at this point in the history
  • Loading branch information
bprusinowski committed Apr 21, 2024
1 parent 8fe962b commit 4a7098c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/charts/BubbleChart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ export const getters = (
// Skip groups with no data.
return !(
isNaN(group.r) ||
group.children?.reduce((acc, d) => (acc += d.r), 0) === 0
!group.children ||
group.children.reduce((acc, d) => (acc += d.r), 0) === 0
);
})
.map((group) => {
Expand Down
3 changes: 2 additions & 1 deletion src/charts/PieChart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ export const getters = (
// Skip groups with no data.
return !(
isNaN(group.r) ||
group.children?.reduce((acc, d) => (acc += d.r), 0) === 0
!group.children ||
group.children.reduce((acc, d) => (acc += d.r), 0) === 0
);
})
.map((group) => {
Expand Down
3 changes: 2 additions & 1 deletion src/charts/TreemapChart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ export const getters = (
// Skip groups with no data.
return !(
group.value === 0 ||
group.children?.reduce((acc, d) => (acc += d.value), 0) === 0
!group.children ||
group.children.reduce((acc, d) => (acc += d.value), 0) === 0
);
})
.map((group) => {
Expand Down

0 comments on commit 4a7098c

Please sign in to comment.