Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Circles with D3

Public visualization

Viewing a saved revision (read-only)

85a4422c96024725a1f176e58b2de9ad

Circles with D3

3 stars445🌍 Public
CCurran Kelleher
Last edited Aug 4, 2025
Created on Jan 9, 2024

This example shows a set of seven colorful circles scattered across an SVG canvas, each with a distinct size, position, and fill color at 70% opacity. It demonstrates core D3.js v7 concepts including data binding, the General Update Pattern, and method chaining via `select`, `selectAll`, `data`, and `join` to render `circle` elements. The visualization uses static, data-driven coordinates and colors defined in a JavaScript array, rendered through an HTML import map loading D3 from a CDN. The code also showcases the `join` API for creating SVG circles within a container sized to the viewport.

AI-generated description

D3 Circles Visualization

This project demonstrates how to create a simple data visualization using D3.js with modern ES6 modules and HTML import maps. It renders colorful circles on an SVG canvas using D3's powerful data-binding capabilities.

Project Structure

Files Overview

index.html - The main HTML file that sets up the page structure and imports D3 index.js - The entry point that initializes the visualization viz.js - Contains the main visualization logic using D3

How It Works

1. D3 Import Setup (index.html)

The project uses modern ES6 import maps to load D3 from a CDN without requiring a build step: