Downsampling
LTTB, MinMax-LTTB, M4, LTOB — preserve the visual shape of millions of points in your charts.
Vizcrush reduces massive browser datasets into bounded, renderer-ready data for D3, Three.js, deck.gl, Canvas, WebGL, and WebGPU
import { lttb } from "@vizcrush/downsample";
// Downsample 1M points to 1K before handing them to your renderer.
const x = new Float64Array(1_000_000);
const y = new Float64Array(1_000_000);
// ... fill x, y with your data ...
const { x: xs, y: ys } = await lttb(x, y, 1000);
// xs, ys are Float64Array[1000] — feed them to any renderer