Force-directed graph · kat-coder-pro-v2
Using the pre-provided d3.min.js (global d3), render an interactive force-directed graph of about 40 nodes in several clusters with draggable nodes, hover highlighting of neighbors, and zoom/pan. Define the sample nodes and links inline.
transcript · 4 messages
Using the pre-provided d3.min.js (global d3), render an interactive force-directed graph of about 40 nodes in several clusters with draggable nodes, hover highlighting of neighbors, and zoom/pan. Define the sample nodes and links inline.
I'll create an interactive force-directed graph visualization using D3.js with all the requested features. Let me build this step by step.
/workspace/index.html (15659 bytes)Successfully wrote 15659 bytes to /workspace/index.html
Perfect! I've created an interactive force-directed graph visualization in `/workspace/index.html`. Here's what's included: ## Features: - **40 nodes** organized into 5 colored clusters (Technology, Science, Arts, Business, Sports) - **70 links** with preferential attachment within clusters - **Draggable nodes** - click and drag to reposition - **Hover highlighting** - hover over nodes to see neighbors and connection info - **Zoom & pan** - mouse wheel to zoom, drag empty space to pan - **Interactive controls**: - Charge strength slider (repulsion between nodes) - Link distance slider (spacing between connected nodes) - Restart simulation button - Reset zoom button - Toggle labels button - **Tooltips** showing node details on hover - **Legend** showing cluster colors - **Zoom indicator** showing current zoom level The graph uses D3's force simulation with collision detection to create natural-looking clusters. Nodes are sized based on random values, and links have varying thickness based on connection strength. Open `index.html` in your browser to see the interactive visualization!
TAKE IT TO CODE
A single self-contained HTML file — copy it and open in any browser, or reuse the prompt with your own pi-agent run.
RUN
EVALUATION
D3 force-directed graph with clusters, drag pans/zoom works, but arrows/enter-space seem to just pan/zoom the view like scroll, not distinct actions.
Vision grade · anthropic/claude-sonnet-5
MEASUREMENTS
Raw readings from the capture, not a verdict — the grade above is the only judgement. Percentages are how much of the screen changed; the measure under-reports sparse motion on a dark background.