PP
← All work

Data Visualization

OneDATA.Plus

A 10K-node customer network graph that marketing teams actually use to pick outbound targets.

Client
Enterprise SaaS for banking compliance
Role
Sole frontend architect
Timeline
18 months overall, 6 weeks for the graph
Team
1 FE, 3 BE, 1 designer, 1 PM

Problem

Marketing teams pulled customer cohorts as CSVs and the signal was buried in row counts. The relationship graph that drives outbound targeting was locked in backend tables, invisible to the people who needed it most.

We built a network graph as the primary visual surface: a star-field universe view, node size by degree, color by segment. The technical problem was rendering 10K live nodes against a real-time backend. SVG breaks past 5K nodes. We needed canvas, the force simulation moved off the main thread, and a virtualized fetch pattern that streamed nodes from S3 on demand.

Constraints

  • 10K nodes at 60fps on a MacBook Air.
  • Data lives in S3, fetched on demand.
  • Zoom, pan, and node click required.
  • Runs inside the React 18 platform shell.

Decisions

Chose

Canvas

Considered

SVG, WebGL

Why

SVG breaks past 5K nodes from DOM cost alone. WebGL was overkill at 10K and would have doubled the maintenance surface. Canvas hit 60fps with one frame budget to spare.

Chose

Force simulation in a Web Worker

Considered

Main-thread force, pre-computed positions

Why

Main-thread force blocks React on every tick. A worker posts position arrays back via transferable buffers, so the main thread only paints.

Chose

On-demand virtualized fetch from S3

Considered

Preload all customers

Why

Preloading hundreds of MB up front killed time-to-first-frame. Streaming what the viewport needs kept the first paint fast.

Chose

Degree-driven node radius and OKLCH color ramp

Considered

Linear RGB ramp by segment

Why

RGB ramps shift hue across lightness. OKLCH keeps hue perceptually constant, so a tiny node and a hub node read as the same segment.

Code sample

components/graph/force-simulation.worker.ts
import {
  forceSimulation,
  forceManyBody,
  forceLink,
  forceCenter,
  forceCollide,
} from 'd3-force'

type Node = { id: string; x: number; y: number; vx: number; vy: number; degree: number }
type Link = { source: string; target: string }

let simulation: ReturnType<typeof forceSimulation<Node, Link>> | null = null
let nodes: Node[] = []

self.onmessage = (event: MessageEvent) => {
  const msg = event.data
  if (msg.type === 'init') {
    nodes = msg.nodes
    simulation = forceSimulation<Node, Link>(nodes)
      .force('charge', forceManyBody().strength(-30))
      .force('link', forceLink<Node, Link>(msg.links).id((n) => n.id).distance(20))
      .force('center', forceCenter(0, 0))
      .force('collide', forceCollide<Node>().radius((n) => 2 + Math.sqrt(n.degree)))
      .stop()

    // Pre-compute layout off the main thread.
    for (let i = 0; i < 200; i++) simulation.tick()
    postPositions()
  }
  if (msg.type === 'tick') {
    if (!simulation) return
    simulation.tick()
    postPositions()
  }
  if (msg.type === 'drag') {
    const node = nodes.find((n) => n.id === msg.id)
    if (node) {
      node.fx = msg.x
      node.fy = msg.y
      simulation?.alphaTarget(0.3).restart()
    }
  }
  if (msg.type === 'release') {
    const node = nodes.find((n) => n.id === msg.id)
    if (node) {
      node.fx = undefined
      node.fy = undefined
      simulation?.alphaTarget(0)
    }
  }
}

function postPositions() {
  const buf = new Float32Array(nodes.length * 2)
  for (let i = 0; i < nodes.length; i++) {
    buf[i * 2] = nodes[i].x
    buf[i * 2 + 1] = nodes[i].y
  }
  ;(self as unknown as Worker).postMessage(buf, [buf.buffer])
}

Live demo

hover for details · click a node to fly in · drag a node to pull it · drag empty space to orbit · scroll to zoom

Full 3D force simulation (d3-force-3d) in a Web Worker, rendered with Three.js as instanced spheres plus additive line edges and halo billboards on hubs. The layout starts from a singularity and explodes outward; color identifies one of ten connected clusters, so the universe reads as a galaxy of communities once it cools. 1,000 entities here for a responsive demo. The production banking SaaS uses the same force-in-worker pipeline against a million-row customer dataset on S3 and streams only the viewport-relevant slice, which is what lets a 10,000-node graph paint under a second on a regulated bank's laptop. Click a node to fly the camera in behind it.

Outcomes

  • 60fps on an M1 MacBook Air, 45fps on an iPhone 13.
  • Time to first frame under 800ms with virtualized fetch.
  • Marketing surfaced highest-degree customers as priority outbound targets.
  • Graph component reused for three downstream surfaces.

What I would do differently

  • Add a WebGL fallback for 50K+ nodes. We hit the canvas ceiling sooner than expected.
  • Pre-bake level-of-detail strategy: hide labels at low zoom, hide edges below a degree threshold.

Stack

React 18D3.js v7CanvasWeb WorkersS3TypeScriptMaterial UIRedux Toolkit

Next case study

React 18 migration

A seven-day sprint that cut platform Time to Interactive from 7.2 seconds to 2.