Skip to content

Commit

Permalink
refactor: Remove redundant point labels from scatter plot
Browse files Browse the repository at this point in the history
  • Loading branch information
sanity committed Nov 27, 2024
1 parent ce8da73 commit b8b7b23
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions hugo-site/static/js/small-world-comparison.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,27 +302,17 @@ waitForD3().then(() => {
{ name: 'Random', x: rnAvgPath, y: rnSuccess }
];

// Add points with labels
const points = svg.selectAll('.point-group')
// Add points
svg.selectAll('.point')
.data(data)
.enter()
.append('g')
.attr('class', 'point-group');

points.append('circle')
.append('circle')
.attr('class', 'point')
.attr('cx', d => x(d.x))
.attr('cy', d => y(d.y))
.attr('r', 6)
.attr('fill', (d, i) => i === 0 ? '#4292c6' : '#08519c');

points.append('text')
.attr('x', d => x(d.x))
.attr('y', d => y(d.y) + 20)
.attr('text-anchor', 'middle')
.style('font-size', '10px')
.text(d => d.name);


}

Expand Down

0 comments on commit b8b7b23

Please sign in to comment.