oneshotlm
Compare all models on this prompt →

Force-directed graph · qwen3.5-flash-02-23

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 · 6 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 user wants me to create a single-page web application with:
1. An interactive force-directed graph
2. About 40 nodes in several clusters
3. Draggable nodes
4. Hover highlighting of neighbors
5. Zoom/pan functionality
6. Using d3.min.js (which is already present)
7. All CSS and JS inline in one index.html file

Let me create this step by step:
- Use D3 v7+ for the force simulation
- Create sample data with ~40 nodes organized in clusters (e.g., 4-5 clusters with 8-10 nodes each)
- Implement dragging with d3.drag()
- Add hover interaction to highlight connected nodes
- Implement zoom/pan with d3.zoom()

I'll write everything into a single index.html file.
write /tmp/ws/index.html (13213 bytes)
toolResult

Successfully wrote 13213 bytes to /tmp/ws/index.html

assistant
thinking
The file has been written. Let me verify it exists.
bash {"command":"ls -la /tmp/ws/index.html && head -20 /tmp/ws/index.html"}
toolResult

-rw-r--r--. 1 node node 13217 Aug 1 17:44 /tmp/ws/index.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Interactive Force-Directed Graph</title> <style> * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); min-height: 100vh; overflow: hidden; }

assistant

Done! I've created a self-contained `index.html` file at `/tmp/ws/index.html` that features: **Features:** - **~40 nodes** (5 clusters of 8 nodes each) with inline data generation - **Force-directed layout** using D3's simulation with link, charge, center, and collision forces - **Draggable nodes** - click and drag any node to reposition - **Hover highlighting** - mouse over a node to highlight connected neighbors and links - **Zoom & Pan** - scroll to zoom in/out, click-drag to pan (dbl-click to reset view) - **Interactive controls**: Zoom In/Out, Reset View, Reposition buttons - **Legend display** showing cluster color mapping - **Cluster colors**: Red, Teal, Blue, Green, Yellow for visual distinction The file uses the local `d3.min.js` via `<script src="d3.min.js"></script>` and contains all CSS in a `<style>` tag and JavaScript in a `<script>` tag — completely self-contained with no external dependencies.

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

modelqwen3.5-flash-02-23
vendorQwen
harnesspi-agent
generated2026-08-01

EVALUATION

4/5 working

Force-directed clustered graph with drag panning and zoom working; nodes settle nicely, keyboard input has no effect 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 motion7.6%
on click0.0%
on drag9.0%
on wheel5.5%
on enter + space0.0%
on arrow keys0.0%
on w/a/s/d0.0%
frame spread52.6 / 255
console errors0
js errors none

METRICS

runtime28.1s
tokens in12k
tokens out3.9k
cached0
cost / run$0.0018