Downsampling
LTTB, MinMax-LTTB, M4, LTOB — preserve the visual shape of millions of points in your charts.
Rust + WASM — downsample, bin, index, and aggregate millions of points at 60fps
import { init } from "@vizcrush/core";
import { lttb } from "@vizcrush/downsample";
// Auto-detect the compute backend (wasm / js)
const ctx = await init();
console.log(`Running on: ${ctx.backend}`);
// Downsample 1M points to 1000 in ~2ms
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