d3-viz

Creates interactive SVG data visualisations with d3.js scales, layouts, and transitions.

1|1|Updated Oct 3, 2021
One-click install
npx skills add https://github.com/benjr70/Smart-Smoker-V2 --skill d3-viz-benjr70
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: d3-viz
Source: https://github.com/benjr70/Smart-Smoker-V2/tree/main/.claude/skills/d3js
Command: npx skills add https://github.com/benjr70/Smart-Smoker-V2 --skill d3-viz-benjr70

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires d3, and includes references (resource) and assets (resource) components.

What problem does it solve? Building custom charts, network diagrams, or geographic visualisations from scratch requires deep knowledge of d3.js scales, layouts, and DOM binding patterns, which slows down development of bespoke visualisations beyond standard charting libraries. ## Core Features & Use Cases - Chart Pattern Library: Ready-to-adapt code for bar, line, scatter, pie, heatmap, chord, treemap, sunburst, and force-directed network diagrams. - Interactivity & Animation: Patterns for tooltips, zoom, pan, brush selection, drag, and choreographed transitions. - Scale & Colour References: Detailed guides covering linear, log, time, band, ordinal, sequential, and diverging scales plus colour-blind-safe palettes. - Use Case: A developer needs a custom heatmap with a colour legend and responsive resizing in a React dashboard; the skill provides the full drawing function, scale setup, and ResizeObserver pattern to adapt. ## Quick Start Ask the AI to create an interactive d3.js bar chart with tooltips and responsive sizing from your dataset.

Frequently Asked Questions about d3-viz

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a bar chart with d3.js?

Create a band scale for categories on the x-axis and a linear scale for values on the y-axis, then bind data to rect elements using .join(). Set each rect's x, y, width, and height from the scales and append axes with d3.axisBottom and d3.axisLeft.

How to make a d3.js chart responsive to container size?

Use a ResizeObserver or window resize listener to read the container's bounding rectangle, then update the SVG width and height attributes and redraw the visualisation. Return a cleanup function that disconnects the observer when the component unmounts.

Can I use d3.js with React, Vue, or Svelte?

Yes, d3 works in any JavaScript environment. Use direct DOM manipulation for complex visualisations with transitions, or use d3 only for scales and layout calculations while rendering elements declaratively through your framework's templating.

When should I use d3.js instead of a charting library?

Use d3 for custom visual encodings, force-directed networks, geographic projections, chord diagrams, or choreographed transitions that standard libraries cannot express. For 3D visualisations, use Three.js instead, as d3 is not designed for that.

Why are my d3.js axes not appearing?

Axes fail when scales have invalid domains containing NaN values, when the axis is appended to the wrong group, or when transform translations are incorrect. Validate your data first and verify the axis group is appended inside the margined container.

Which d3 colour schemes are colour-blind safe?

Use d3.interpolateViridis or d3.interpolateCividis for sequential data and the Okabe-Ito categorical palette for categories. Avoid red-green diverging combinations; prefer blue-orange schemes like d3.interpolatePuOr or d3.interpolateBrBG.