oneshotlm
Compare all models on this prompt →

Force-directed graph · grok-4.3

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.

⛨ sandboxed Open in new tab ↗
transcript · 10 messages
user

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.

assistant
thinking
The task is: Build a single-page web app and write it ALL into one self-contained file named index.html in the current directory: CSS in a <style> tag, JS in a <script> tag, inline — do not create sep...
bash {"command":"ls -la"}
toolResult

total 324 drwxrwxrwx 3 node node 96 Jul 22 17:03 . drwxr-xr-x 1 root root 4096 Jul 22 17:03 .. -rw-r--r-- 1 node node 279706 Jul 22 17:03 d3.min.js

assistant
thinking
The d3.min.js is present. Now I need to create a single self-contained index.html that uses d3 from that file via <script src="d3.min.js"></script>, and includes everything inline: CSS and JS. No exte...
write index.html (6237 bytes)
toolResult

Successfully wrote 6237 bytes to index.html

assistant
thinking
Done. The file index.html has been created containing a fully self-contained interactive D3 force-directed graph. It uses the provided d3.min.js, features ~40 nodes across 5 colored clusters, draggabl...
bash {"command":"ls -la index.html"}
toolResult

-rw-r--r-- 1 node node 6241 Jul 22 17:03 index.html

assistant
thinking
The index.html is created with a working self-contained force-directed graph using D3. It includes exactly 40 nodes, multiple clusters with proper intra/inter links, drag, hover neighbor highlighting,...
bash {"command":"head -30 index.html"}
toolResult

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Force-Directed Graph</title> <style> body { margin: 0; background: #0f172a; font-family: system-ui, sans-serif; color: #e2e8f0; } #container { width: 100vw; height: 100vh; position: relative; } svg { width: 100%; height: 100%; display: block; cursor: grab; } .node { stroke: #1e293b; stroke-width: 1.5px; cursor: pointer; } .link { stroke: #475569; stroke-opacity: 0.7; stroke-width: 1.5px; } .node-label { font-size: 10px; fill: #cbd5e1; pointer-events: none; text-anchor: middle; } .legend { position: absolute; top: 16px; left: 16px; background: #1e293b; padding: 12px 16px; border-radius: 8px; font-size: 13px; box-shadow: 0 4px 6px rgb(0 0 0 / 0.2); } .legend-item { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; } .legend-color { width: 14px; height: 14px; border-radius: 50%; } </style> </head> <body> <div id="container"> <svg id="graph"></svg> <div class="legend"> <div><strong>Clusters</strong></div> <div class="legend-item"><div class="legend-color" style="background:#22d3ee"></div>Cluster A</div> <div class="legend-item"><div class="legend-color" style="background:#a78bfa"></div>Cluster B</div> <div class="legend-item"><div class="legend-color" style="background:#fb923c"></div>Cluster C</div> <div class="legend-item"><div class="legend-color" style="background:#4ade80"></div>Cluster D</div> <div class="legend-item"><div class="legend-color" style="background:#f472b6"></div>Cluster E</div> <div style="margin-top:8px;font-size:10px;opacity:0.7">Drag nodes • Hover to highlight • Scroll to zoom</div> </div>

assistant
thinking
The file is complete and index.html exists with d3 loaded and all requested functionality inline.

Done. `index.html` created with a fully self-contained 40-node interactive force graph using only the local `d3.min.js`. Features: - 5 colored clusters with inline sample data - Draggable nodes (D3 drag) - Hover neighbor highlighting - Zoom/pan via built-in D3 zoom - All CSS/JS inline; no external resources.

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

modelgrok-4.3
vendorxAI · Grok
harnesspi-agent
generated2026-07-22

EVALUATION

4/5 working

Force-directed clustered graph renders correctly; drag pans/reorganizes, wheel zooms deeply; static under idle and keyboard input as expected.

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.

idle motion0.0%
on click0.0%
on drag4.8%
on wheel3.3%
on enter + space0.0%
on arrow keys0.0%
on w/a/s/d0.0%
frame spread16.6 / 255
console errors0
js errors none

METRICS

runtime33.0s
tokens in4.3k
tokens out2.7k
cached11k
cost / run$0.0143