Skip to content

Commit

Permalink
#38: add value is NaN check when visualizing data
Browse files Browse the repository at this point in the history
  • Loading branch information
m4nv3ru committed Apr 15, 2022
1 parent 517841c commit 317acea
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,13 @@ export default class BubbleChart extends React.Component {
const root = hierarchy({ children: this.state.content }).sum(d => d.activity);
layout(root);

const leaf = bubbleArea.selectAll('g').data(root.leaves()).join('g').attr('transform', d => `translate(${d.x},${d.y})`);
leaf.append('circle').attr('fill', d => this.state.colors.get(d.data.id)).attr('data', d => d.data.id).attr('r', d => d.r);
const leaves = root.leaves();
if (leaves.length === 0 || !leaves[0].r) {
return;
}

const leaf = bubbleArea.selectAll('g').data(leaves).join('g').attr('transform', d => `translate(${d.x},${d.y})`);
leaf.append('circle').attr('fill', d => this.state.colors.get(d.data.id)).attr('r', d => d.r);
leaf.on('mouseenter', d => this.constructActiveLegend(d.target));
leaf.on('mouseleave', () => this.setState({ activeLegend: null }));
}
Expand Down

0 comments on commit 317acea

Please sign in to comment.