UNPKG

@tanstack/charts

Version:

<div align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://tanstack.com/api/readme/charts.png?theme=dark" /> <source media="(prefers-color-scheme: light)" srcset="https://tanstack.com/

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 };