agentsclimarketplace

D3 interactive datatable

Skill cxcscmu/SkillLearnBench/skills/b4-skill-creator-claude-opus-4-6/stock-data-visualization/d3-interactive-datatable

Build interactive data tables with D3.js that are linked to other D3 visualizations. Use this skill when building HTML tables with D3 that need click-to-highlight interaction, synchronized selection with charts, or formatted numeric columns. Triggers on: data table, interactive table, linked table and chart, click to highlight.From its SKILL.md

Install
npx -y skills add cxcscmu/SkillLearnBench --skill d3-interactive-datatable

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

SKILL.md

2.5 KB, 582 tokens by cl100k_base, as published. Nobody here has run it

D3 Interactive Data Table

Overview

Create HTML <table> elements using D3's data join pattern, with click-based interaction that synchronizes with other visualizations (e.g., a bubble chart).

Building the Table

const table = d3.select("#table-container")
  .append("table");

const thead = table.append("thead").append("tr");
thead.selectAll("th")
  .data(columns)
  .join("th")
  .text(d => d.label);

const tbody = table.append("tbody");
const rows = tbody.selectAll("tr")
  .data(data)
  .join("tr")
  .attr("data-ticker", d => d.ticker);

rows.selectAll("td")
  .data(d => columns.map(col => col.accessor(d)))
  .join("td")
  .text(d => d);

Formatting Market Cap

Format large numbers into human-readable form (e.g., 1.64T, 345.98B):

function formatMarketCap(value) {
  if (!value) return "N/A";
  if (value >= 1e12) return (value / 1e12).toFixed(2) + "T";
  if (value >= 1e9) return (value / 1e9).toFixed(2) + "B";
  if (value >= 1e6) return (value / 1e6).toFixed(2) + "M";
  return value.toLocaleString();
}

Click-to-Highlight Synchronization

Pattern: Shared Selection State

Maintain a shared selection state and update both the chart and the table when selection changes.

function selectStock(ticker) {
  // Highlight the table row
  d3.selectAll("#table-container tr")
    .classed("highlighted", d => d && d.ticker === ticker);

  // Highlight the bubble
  d3.selectAll(".bubble")
    .classed("highlighted", d => d.ticker === ticker);

  // Scroll the table row into view
  const row = document.querySelector(`tr[data-ticker="${ticker}"]`);
  if (row) row.scrollIntoView({ behavior: "smooth", block: "center" });
}

Binding Click Events

// On bubble click
bubbles.on("click", (event, d) => selectStock(d.ticker));

// On table row click
rows.on("click", (event, d) => selectStock(d.ticker));

Styling

  • Use position: sticky on <thead> for scrollable tables
  • Highlight rows with a distinct background color on .highlighted class
  • Add hover effects on rows for discoverability
  • Use alternating row colors for readability

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.