- Home
- Skills
- Bbeierle12
- Skill Mcp Claude
- D3js Visualization
d3js-visualization_skill
- JavaScript
6
GitHub Stars
2
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill bbeierle12/skill-mcp-claude --skill d3js-visualization- _meta.json317 B
- SKILL.md6.9 KB
Overview
This skill builds interactive, production-ready D3.js charts and custom data visualizations. It provides reusable patterns for bar, line, scatter, pie/donut, force-directed, and map visualizations with tooltips, transitions, zoom/pan, and accessibility considerations. Use it to convert raw data into responsive, animated SVG visualizations that integrate into web apps.
How this skill works
The skill exposes functions and patterns that create SVG containers, bind data via d3.select and .data().join(), and generate scales, axes, and shape generators for common chart types. It adds interactivity through event handlers for tooltips, transitions for animated updates, and d3.zoom for pan/zoom behavior. Performance and accessibility recommendations are included (use join(), throttle resize, add ARIA labels, and provide data table fallbacks).
When to use it
- You need a custom, animated chart beyond built-in chart libraries.
- You want fine-grained control over scales, axes, and visual encoding.
- You must add interactive features: tooltips, zoom/pan, or animated data updates.
- You require SVG-based, responsive visualizations for dashboards or storytelling.
- You need accessible charts with data-table fallbacks and ARIA annotations.
Best practices
- Use selection.join() for enter/update/exit flows to keep code concise and efficient.
- Precompute scales and call .nice() for readable axis ticks and boundaries.
- Throttle or debounce window resize handlers and expensive layout recalculations.
- Keep styling in CSS when possible; minimize DOM element creation during updates.
- Add aria-label and role attributes and provide a data table or CSV export for accessibility.
Example use cases
- Create a responsive bar chart with animated updates and value tooltips for dashboard metrics.
- Render a time-series line chart with date parsing, curve smoothing, and hoverable data points.
- Build a donut chart with labeled arcs and color ordinal scales for categorical breakdowns.
- Implement a scatter plot with zoom/pan and tooltip details for exploratory data analysis.
- Compose a force-directed network graph with transitions and interactive node highlighting.
FAQ
Use selection.transition() with duration and optional delay; update scales first, then transition attributes like y, height, cx, or path d().
What scale should I pick for categorical vs numeric axes?
Use d3.scaleBand for discrete categories (bars) and d3.scaleLinear or d3.scaleTime for continuous numeric or temporal data.
How can I add tooltips without layout jank?
Create a single tooltip div appended to body, position it on mousemove using event.pageX/Y, and avoid DOM reflows by updating only style.top/left and innerHTML.
How to ensure good performance on large datasets?
Limit DOM nodes (use canvas for extremely large point counts), reuse elements with join(), throttle interactions, and simplify visual details during animations.