Three.js Social Media Analytics (Streamgraph & Bubble Chart)
Engagement analytics in Three.js for 60 days of synthetic posts across five content channels, shown as an extruded 3D streamgraph or a log-scale bubble chart with reach as size and hover details.
Key topics: social media analytics, streamgraph, bubble chart, engagement metrics, three.js dashboard, data visualization
Game Over
What this code does
- Streamgraph: daily totals per channel are stacked around a centred baseline, so the silhouette shows overall volume and each ribbon its share.
- Smoothing: a moving average of ±N days hides daily noise while keeping weekly rhythm.
- Bubble Chart: one bubble per post, with x = day, y = log engagement (viral posts sit decades above typical ones), z = channel and size = √reach.
- Synthetic Behaviour: weekly cycles, channel trends (Live rising, Short text fading) and rare viral spikes with heavy share counts.
- Metrics: likes, shares and comments behave differently, for example long-form posts draw comments.
- Controls: view, metric, smoothing and viral spikes; hover bubbles for post details.
Related Demos
Continue Learning
JavaScript Implementation
// Streamgraph: stack series around a centred baseline so the silhouette is symmetric
let base = days.map((_, d) => -total[d] / 2)
for (const series of channels) {
const top = base.map((b, d) => b + series[d])
const ribbon = [] // two vertices per day: (x, base) and (x, top)
days.forEach((_, d) => ribbon.push(x(d), base[d], 0, x(d), top[d], 0))
scene.add(new THREE.Mesh(triangleStrip(ribbon), new THREE.MeshStandardMaterial({ color: series.color })))
base = top
}