jpskill.com
🎨 デザイン コミュニティ

d3

D3.jsを使って、グラフや地図、ネットワーク図など、既存のツールでは難しい、より細かく制御されたインタラクティブなデータ可視化を構築支援するSkill。

📜 元の英語説明(参考)

Assists with building custom interactive data visualizations using D3.js. Use when creating charts, graphs, maps, force layouts, or hierarchical diagrams that require fine-grained control beyond what charting libraries provide. Trigger words: d3, data visualization, chart, svg, scales, force graph, treemap, choropleth.

🇯🇵 日本人クリエイター向け解説

一言でいうと

D3.jsを使って、グラフや地図、ネットワーク図など、既存のツールでは難しい、より細かく制御されたインタラクティブなデータ可視化を構築支援するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o d3.zip https://jpskill.com/download/14810.zip && unzip -o d3.zip && rm d3.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/14810.zip -OutFile "$d\d3.zip"; Expand-Archive "$d\d3.zip" -DestinationPath $d -Force; ri "$d\d3.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して d3.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → d3 フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

D3.js

概要

D3.js は、データを DOM 要素にバインドすることで、カスタムでインタラクティブなデータ視覚化を構築するための低レベルな JavaScript ライブラリです。スケール、軸、形状ジェネレーター、地理的投影、力シミュレーション、階層レイアウトを提供し、開発者は React との統合を通じて、計算されたスケールとレイアウトを介して、視覚的な出力の完全な制御を可能にします。

指示

  • データをバインドする際は、enter/update/exit パターンには .data(dataset).join("element") (D3 v6+) を使用し、アクセサ関数を介してバインドされたデータから属性とスタイルを設定します。
  • スケールを作成する際は、適切なタイプ (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 を数学 (スケール、レイアウト、データ変換) に使用し、React を DOM レンダリングに使用し、useMemo で値を計算し、D3 駆動のアニメーションには ref を持つ useEffect を使用します。

例 1: 複数のチャートタイプを持つリアルタイムダッシュボードを構築する

ユーザーリクエスト: "API データから折れ線グラフ、棒グラフ、円グラフを持つダッシュボードを作成してください"

アクション:

  1. x軸に d3.scaleTime()、y軸に d3.scaleLinear() を使用して共有スケールを設定します
  2. スムーズな曲線補間と塗りつぶしで d3.line() を使用して折れ線グラフを構築します
  3. 千鳥状の enter トランジションで d3.scaleBand() を使用してグループ化された棒グラフを構築します
  4. ホバーツールチップで d3.pie()d3.arc() を使用してドーナツチャートを構築します

出力: データが変更されたときにスムーズに更新されるアニメーションチャートを備えた、レスポンシブなダッシュボード。

例 2: 力指向ネットワークグラフを作成する

ユーザーリクエスト: "エンティティ間の関係をインタラクティブなネットワークグラフとして視覚化してください"

アクション:

  1. forceManyBodyforceLink、および forceCenter を使用して d3.forceSimulation() を設定します
  2. カテゴリ別に色分けされた d3.scaleOrdinal() でノードを円としてレンダリングします
  3. d3.drag() でドラッグインタラクションを追加してノードを再配置します
  4. d3.zoom() でズームとパンを実装し、ホバー時にツールチップを表示します

出力: ドラッグ可能なノード、色分けされたカテゴリ、およびズームナビゲーションを備えたインタラクティブな力指向グラフ。

ガイドライン

  • スケール、レイアウト、およびデータ処理には D3 を使用します。React アプリでは React に DOM レンダリングを処理させます。
  • よりシンプルでクリーンなデータバインディングのために、手動の enter/update/exit の代わりに .join() を使用します。
  • 範囲をハードコーディングするのではなく、常にデータ (d3.extent()) からスケールドメインを設定します。
  • 軸ラベルとツールチップには d3.format() を使用します。数千の場合は ",.0f"、通貨の場合は "$.2f"
  • スムーズなデータ更新アニメーションのために、easeCubicInOut で 750ms のトランジションを追加します。
  • ResizeObserver コールバックでスケールを再計算することにより、視覚化をレスポンシブにします。
  • アクセシビリティのために、SVG 要素に aria-label を追加し、意味のある <title> タグを追加します。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

D3.js

Overview

D3.js is a low-level JavaScript library for building custom, interactive data visualizations by binding data to DOM elements. It provides scales, axes, shape generators, geographic projections, force simulations, and hierarchical layouts, giving developers full control over the visual output while integrating with React through computed scales and layouts.

Instructions

  • When binding data, use .data(dataset).join("element") (D3 v6+) for the enter/update/exit pattern, setting attributes and styles from bound data via accessor functions.
  • When creating scales, choose the appropriate type (scaleLinear for continuous, scaleBand for categorical bars, scaleTime for dates, scaleOrdinal for color mapping) and always set domain from the data using d3.extent().
  • When building axes, create them with d3.axisBottom(scale) or d3.axisLeft(scale), configure ticks and format labels with d3.format(), and regenerate on resize.
  • When creating chart types, use shape generators (d3.line(), d3.area(), d3.arc(), d3.pie(), d3.stack()) and layout functions (d3.treemap(), d3.forceSimulation(), d3.geoPath()) for complex visualizations.
  • When adding interactivity, use transitions (.transition().duration(750)) for smooth data updates, tooltips on hover, and brushing/zooming for exploration.
  • When integrating with React, use D3 for math (scales, layouts, data transforms) and React for DOM rendering, computing values in useMemo and using useEffect with refs for D3-driven animations.

Examples

Example 1: Build a real-time dashboard with multiple chart types

User request: "Create a dashboard with line charts, bar charts, and a pie chart from API data"

Actions:

  1. Set up shared scales with d3.scaleTime() for the x-axis and d3.scaleLinear() for the y-axis
  2. Build a line chart using d3.line() with smooth curve interpolation and area fill
  3. Build a grouped bar chart using d3.scaleBand() with staggered enter transitions
  4. Build a donut chart using d3.pie() and d3.arc() with hover tooltips

Output: A responsive dashboard with animated charts that update smoothly when data changes.

Example 2: Create a force-directed network graph

User request: "Visualize relationships between entities as an interactive network graph"

Actions:

  1. Set up d3.forceSimulation() with forceManyBody, forceLink, and forceCenter
  2. Render nodes as circles with d3.scaleOrdinal() coloring by category
  3. Add drag interaction with d3.drag() to reposition nodes
  4. Implement zoom and pan with d3.zoom() and tooltips on hover

Output: An interactive force-directed graph with draggable nodes, color-coded categories, and zoom navigation.

Guidelines

  • Use D3 for scales, layouts, and data processing; let React handle DOM rendering in React apps.
  • Use .join() instead of manual enter/update/exit for simpler, cleaner data binding.
  • Always set scale domains from data (d3.extent()) rather than hardcoding ranges.
  • Use d3.format() for axis labels and tooltips: ",.0f" for thousands, "$.2f" for currency.
  • Add transitions of 750ms with easeCubicInOut for smooth data update animations.
  • Make visualizations responsive by recalculating scales on ResizeObserver callbacks.
  • Add aria-label to SVG elements and meaningful <title> tags for accessibility.