UNPKG

@tanstack/charts

Version:

A chart grammar for TypeScript and JavaScript. Marks consume your data directly, channels describe visual encodings, and the engine compiles them into a renderer-neutral keyed scene. TanStack's compact scales cover common numeric and categorical mappings.

15 lines (14 loc) 400 B
import { area as createAreaPath } from "d3-shape"; function d3AreaXCurve(curve) { const areaPath = createAreaPath().x0((point) => point[1]).x1((point) => point[2]).y((point) => point[0]).curve(curve); return { areaX: (right, left) => areaPath( right.map( (point, index) => [point[1], left[index]?.[0] ?? point[0], point[0]] ) ) ?? "" }; } export { d3AreaXCurve };