Communitygithub.com

D3.js

맞춤형 대화형 데이터 시각화를 구축하는 데 도움을 줍니다. 차트, 그래프, 지도, 포스 레이아웃 또는 계층형 다이어그램을 만들 때 사용하세요.

D3.js란 무엇인가요?

이 스킬은 D3.js 라이브러리를 사용하여 고급 맞춤형 데이터 시각화를 생성하는 데 특화되어 있습니다. D3.js는 데이터를 DOM 요소에 바인딩하여 차트, 그래프, 지도, 힘 기반 시뮬레이션, 계층형 레이아웃 등을 구축할 수 있는 저수준 JavaScript 라이브러리입니다. 이 스킬은 스케일, 축, 셰이프 생성기, 지리적 투영, 힘 시뮬레이션, 계층형 레이아웃과 같은 핵심 기능을 강조하며, React와 통합할 때는 계산된 스케일과 레이아웃을 통해 DOM 렌더링을 React에 맡기도록 안내합니다. 개발자는 `.join()`을 사용한 최신 데이터 바인딩 패턴, `d3.extent()`를 활용한 동적 도메인 설정, `d3.format()`을 통한 축 레이블 포맷팅, 750ms 트랜지션과 `easeCubicInOut`을 적용한 부드러운 애니메이션 등 권장 가이드라인을 따를 수 있습니다. 샘플 사용 사례로는 실시간 대시보드 (선형 차트, 막대 차트, 도넛 차트)와 끌어서 놓기 및 줌 기능을 갖춘 힘 기반 네트워크 그래프가 포함되어 있어, 데이터에 세밀한 제어가 필요한 시나리오에서 이상적입니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/TerminalSkills/skills/tree/HEAD/skills/d3

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

D3.js은(는) 무엇을 하나요?

개요

D3.js는 데이터를 DOM 요소에 바인딩하여 맞춤형 대화형 데이터 시각화를 구축하기 위한 저수준 JavaScript 라이브러리입니다. 스케일, 축, 셰이프 생성기, 지리적 투영, 힘 시뮬레이션, 계층형 레이아웃을 제공하여 개발자가 시각적 출력을 완전히 제어할 수 있게 하며, 계산된 스케일과 레이아웃을 통해 React와 통합됩니다.

지침

  • 데이터를 바인딩할 때는 .data(dataset).join("element") (D3 v6+)를 사용하여 enter/update/exit 패턴을 구현하고, 접근자 함수를 통해 바인딩된 데이터에서 속성과 스타일을 설정합니다.
  • 스케일을 만들 때는 적절한 유형을 선택하고 (scaleLinear는 연속형, scaleBand는 범주형 막대, scaleTime은 날짜, scaleOrdinal은 컬러 매핑), 항상 d3.extent()를 사용하여 데이터에서 도메인을 설정합니다.
  • 축을 구축할 때는 d3.axisBottom(scale) 또는 d3.axisLeft(scale)로 생성하고, d3.format()을 사용하여 눈금을 구성하고 레이블 형식을 지정하며, 크기가 변경될 때 다시 생성합니다.
  • 차트 유형을 만들 때는 복잡한 시각화를 위해 셰이프 생성기 (d3.line(), d3.area(), d3.arc(), d3.pie(), d3.stack())와 레이아웃 함수 (d3.treemap(), d3.forceSimulation(), d3.geoPath())를 사용합니다.
  • 상호 작용을 추가할 때는 부드러운 데이터 업데이트를 위한 트랜지션 (.transition().duration(750)), 호버 시 툴팁, 탐색을 위한 브러싱/줌을 사용합니다.
  • React와 통합할 때는 수학(스케일, 레이아웃, 데이터 변환)에 D3를 사용하고 DOM 렌더링에는 React를 사용하며, useMemo에서 값을 계산하고 useEffect와 ref를 사용하여 D3 기반 애니메이션을 처리합니다.

예제

예제 1: 여러 차트 유형으로 실시간 대시보드 구축

사용자 요청: "API 데이터로 선형 차트, 막대 차트, 원형 차트가 있는 대시보드를 만들어 주세요"

작업:

  1. x축에는 d3.scaleTime(), y축에는 d3.scaleLinear()로 공유 스케일 설정
  2. 부드러운 곡선 보간과 영역 채우기가 있는 d3.line()을 사용하여 선형 차트 구축
  3. 지연된 enter 트랜지션이 있는 d3.scaleBand()를 사용하여 그룹 막대 차트 구축
  4. 호버 툴팁이 있는 d3.pie()와 d3.arc()를 사용하여 도넛 차트 구축

출력: 데이터가 변경될 때 부드럽게 업데이트되는 애니메이션 차트가 있는 반응형 대시보드.

예제 2: 힘 기반 네트워크 그래프 생성

사용자 요청: "개체 간의 관계를 대화형 네트워크 그래프로 시각화해 주세요"

작업:

  1. forceManyBody, forceLink, forceCenter로 d3.forceSimulation() 설정
  2. 범주별로 d3.scaleOrdinal()로 색상을 지정하여 원형 노드 렌더링
  3. d3.drag()로 노드를 다시 배치하기 위한 드래그 상호 작용 추가
  4. d3.zoom()으로 줌 및 팬 구현, 호버 시 툴팁 추가

출력: 드래그 가능한 노드, 색상 코드 범주, 줌 탐색이 있는 대화형 힘 기반 그래프.

가이드라인

  • 스케일, 레이아웃, 데이터 처리에는 D3를 사용하고, React 앱에서는 DOM 렌더링을 React가 처리하도록 합니다.
  • 수동 enter/update/exit보다는 .join()을 사용하여 더 간단하고 깔끔한 데이터 바인딩을 구현합니다.
  • 스케일 도메인은 범위를 하드코딩하지 말고 항상 데이터(d3.extent())에서 설정합니다.
  • 축 레이블과 툴팁에는 d3.format()을 사용합니다: ",.0f"는 천 단위, "$.2f"는 통화.
  • 부드러운 데이터 업데이트 애니메이션을 위해 easeCubicInOut과 함께 750ms 트랜지션을 추가합니다.
  • ResizeObserver 콜백에서 스케일을 다시 계산하여 시각화를 반응형으로 만듭니다.
  • 접근성을 위해 SVG 요소에 aria-label과 의미 있는 <title> 태그를 추가합니다.

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

TerminalSkills/skills

>- Run GitHub Actions locally with act. Use when a user asks to test GitHub Actions workflows locally, debug CI pipelines without pushing, or run workflows offline.

TerminalSkills/skills

>- You are an expert in AG2 (formerly AutoGen), the open-source multi-agent conversation framework. You help developers build systems where multiple AI agents collaborate through structured conversations — with tool use, human-in-the-loop, code execution, group chat orchestration, and nested conversations — for complex tasks like software development, research, and data analysis.

TerminalSkills/skills

>- Generate short-form videos with AI — script writing, text-to-speech narration, stock footage selection, subtitle generation, and video assembly. Use when: creating TikTok/YouTube Shorts/Reels content, automating video production, building content pipelines.

TerminalSkills/skills

>- Animate 3D objects and characters in Blender with Python. Use when the user wants to keyframe properties, create armatures and rigs, set up IK/FK chains, animate shape keys for facial animation, edit F-Curves, use the NLA editor to blend actions, add drivers for expression-based animation, or script any animation workflow in Blender.

TerminalSkills/skills

>- Automate motion capture and tracking workflows in Blender with Python. Use when the user wants to import BVH or FBX mocap data, retarget motion to armatures, track camera or object motion from video, solve camera motion, clean up motion capture data, or script any tracking pipeline in Blender.

TerminalSkills/skills

>- You are an expert in Bolt.new by StackBlitz, the AI-powered full-stack development environment that runs entirely in the browser. You help developers go from idea to deployed app in minutes using natural language prompts — Bolt generates complete applications with frontend, backend, database, and deployment, all running in a WebContainer without local setup.

TerminalSkills/skills

>- Assists with using Bun as an all-in-one JavaScript/TypeScript runtime, package manager, bundler, and test runner. Use when building HTTP servers, managing packages, running tests, or migrating from Node.js. Trigger words: bun, bun serve, bun install, bun test, bun build, javascript runtime, bun runtime.

TerminalSkills/skills

>- Self-host customer support with Chatwoot. Use when a user asks to set up open-source customer support, add live chat without SaaS costs, build a multi-channel inbox, or deploy a free Intercom alternative.

TerminalSkills/skills

>- You are an expert in Chi, the lightweight, idiomatic Go HTTP router built on `net/http`. You help developers build composable HTTP services using Chi's middleware stack, route groups, URL parameters, sub-routers, and context-based request scoping — providing Express-like ergonomics while staying 100% compatible with Go's standard library.

TerminalSkills/skills

When the user wants to edit, review, or improve existing marketing copy. Also use when the user mentions 'edit this copy,' 'review my copy,' 'copy feedback,' 'proofread,' 'polish this,' 'make this better,' or 'copy sweep.' This skill provides a systematic approach to editing marketing copy through multiple focused passes.

TerminalSkills/skills

>- Add live chat and customer support with Crisp. Use when a user asks to add a chat widget, implement live customer support, set up a help desk, create a knowledge base, or add a chatbot to a website.

TerminalSkills/skills

dbt (data build tool) transforms data in your warehouse using SQL SELECT statements. Learn project setup, models, tests, documentation, incremental materializations, and integration with data warehouses like PostgreSQL, BigQuery, and Snowflake.

TerminalSkills/skills

>- You are an expert in dlt, the open-source Python library for building data pipelines. You help developers load data from any API, file, or database into warehouses and lakes using simple Python decorators — with automatic schema inference, incremental loading, and built-in data contracts. dlt is the "requests library for data pipelines.

TerminalSkills/skills

Data Version Control for ML projects. Track large datasets and models alongside Git, build reproducible ML pipelines, and run experiments with metric comparison. Works with any storage backend including S3, GCS, Azure, and local filesystems.

TerminalSkills/skills

>- You are an expert in E2B, the cloud platform for running AI-generated code in secure sandboxes. You help developers give AI agents the ability to execute code, install packages, read/write files, and run long processes in isolated cloud environments — each sandbox is a lightweight VM that boots in ~150ms with full Linux, filesystem, and networking.

TerminalSkills/skills

>- Transcode, convert, edit, and process audio and video with FFmpeg. Use when a user asks to convert video formats (webm to mp4, mkv to mp4), extract audio from video, compress video files, trim or cut clips, concatenate videos, add subtitles, create thumbnails, apply filters, change resolution or bitrate, re-encode media, create GIFs from video, add watermarks, normalize audio, stream media, or build automated media processing pipelines.

TerminalSkills/skills

>- Create advanced animations with GSAP. Use when building complex timelines, scroll-driven animations, SVG morphing, text animations, or high-performance web animations beyond CSS capabilities.

TerminalSkills/skills

>- Generate deterministic MP4 videos from HTML, CSS, media, and seekable animations using HeyGen's HyperFrames framework. Use when someone asks to "render HTML to video", "make a video with HyperFrames", "create a programmatic video", "turn an animation into MP4", "build a launch/product video from HTML", "render GSAP/Lottie/Three.js to video", or set up an agent-driven video pipeline. Covers init/preview/render/add/lint/inspect commands, data-* timing attributes, animation adapters, and the component catalog.

TerminalSkills/skills

When the user wants to perform load testing, stress testing, or performance testing of APIs and websites using k6. Also use when the user mentions "k6," "load test," "performance test," "stress test," "spike test," "soak test," "thresholds," "virtual users," or "VUs." For browser-based testing, see selenium.

TerminalSkills/skills

>- Lovable (formerly GPT Engineer) is a browser-based AI app builder that turns a natural-language description into a working full-stack web app with a built-in backend, authentication, database and one-click publishing. Use when the user wants to prototype or ship a web app with Lovable, write effective Lovable prompts, connect Supabase or GitHub, review generated security rules, or move a Lovable project into their own editor.

관련 스킬