agentsclimarketplace

D3 bubble chart force

Skill cxcscmu/SkillLearnBench/skills/b4-skill-creator-gemini-3-flash-preview/stock-data-visualization/d3-bubble-chart-force

[COLM'26] SkillLearnBench is the first benchmark for evaluating continual learning methods that automatically generate agent skills.From the repository description

Install
npx -y skills add cxcscmu/SkillLearnBench --skill d3-bubble-chart-force

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

SKILL.md

1.9 KB, 530 tokens by cl100k_base, as published. Nobody here has run it

name: d3-bubble-chart-force description: How to create a bubble chart with D3.js v6 using force simulations for clustering and preventing overlaps. Use this skill whenever a bubble chart with clustered layouts is requested.

Implementation Guide

1. Data Preparation

Ensure each data point has:

  • A unique identifier (e.g., ticker)
  • A value for sizing (e.g., marketCap)
  • A categorical value for clustering (e.g., sector)

2. Sizing Scale

Use d3.scaleSqrt() for bubble radii to ensure the area of the bubble is proportional to the value.

const radiusScale = d3.scaleSqrt()
    .domain([0, d3.max(data, d => d.marketCap || constantValue)])
    .range([minRadius, maxRadius]);

3. Force Simulation

Set up d3.forceSimulation() with multiple forces:

  • forceX and forceY: Pull nodes toward their sector's cluster center.
  • forceCollide: Prevent bubbles from overlapping.
  • forceManyBody: Add slight repulsion if needed to avoid overcrowding.
const simulation = d3.forceSimulation(data)
    .force("x", d3.forceX(d => sectorCenters[d.sector].x).strength(0.1))
    .force("y", d3.forceY(d => sectorCenters[d.sector].y).strength(0.1))
    .force("collide", d3.forceCollide(d => radiusScale(d.marketCap || constantValue) + padding))
    .on("tick", () => {
        node.attr("cx", d => d.x)
            .attr("cy", d => d.y);
    });

4. Tooltips

Use a hidden div and update its position and content on mouse events.

const tooltip = d3.select("body").append("div").attr("class", "tooltip").style("opacity", 0);

node.on("mouseover", (event, d) => {
    tooltip.transition().duration(200).style("opacity", .9);
    tooltip.html(`Ticker: ${d.ticker}<br>Name: ${d.full_name}`)
           .style("left", (event.pageX + 10) + "px")
           .style("top", (event.pageY - 28) + "px");
})
.on("mouseout", () => {
    tooltip.transition().duration(500).style("opacity", 0);
});

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.