stacks/ts-charts
publicClone
Push over the same URL. A password will not work: create a token under access tokens and use it in place of one.
- .config
- .github
- .vscode
- docs
- packages
- test
- .editorconfig 147 B
- .env.test 23 B
- .gitattributes 12 B
- .gitignore 108 B
- bun.lock 47.8 KB
- bunfig.toml 161 B
- CHANGELOG.md 11.2 KB
- deps.yaml 32 B
- LICENSE.md 1.1 KB
- package.json 2.5 KB
- pantry.lock 8.7 KB
- README.md 5.9 KB
- tsconfig.json 2.7 KB

ts-charts
A complete TypeScript rewrite of D3.js — fully typed, zero dependencies, Bun-first.
All 30 D3.js packages, rewritten from the ground up in TypeScript with isolatedDeclarations support. Ships as a single umbrella package or 30+ individually installable sub-packages.
Features
- 🔷 Fully Typed — strict TypeScript with
isolatedDeclarations: true, noanyleaks - 📦 Zero Dependencies — no external runtime dependencies, everything inlined
- ⚡ Bun-First — optimized for Bun, works in all modern browsers
- 🌳 Tree-Shakeable — ESM-only, import only what you need
- 🧪 3,500+ Tests — comprehensive test suite ported from D3, all passing
- 🎯 D3 API Compatible — drop-in replacement for D3.js
Install
# install the umbrella package (everything)
bun add ts-charts
# or install individual packages
bun add @ts-charts/scale
bun add @ts-charts/selection
bun add @ts-charts/shapeUsage
// import everything
import { scaleLinear, line, select } from 'ts-charts'
// or import from individual packages
import { scaleLinear } from '@ts-charts/scale'
import { line } from '@ts-charts/shape'
import { select } from '@ts-charts/selection'
// create a linear scale
const x = scaleLinear()
.domain([0, 100])
.range([0, 960])
// create a line generator
const myLine = line()
.x((d: [number, number]) => x(d[0]))
.y((d: [number, number]) => d[1])Packages
| Package | Description |
|---|---|
@ts-charts/array | Array manipulation, statistics, histograms, bisection |
@ts-charts/axis | SVG axis generators for scales |
@ts-charts/brush | 1D and 2D brush selections |
@ts-charts/chord | Chord diagram layout and ribbon generator |
@ts-charts/color | Color spaces: RGB, HSL, Lab, HCL, Cubehelix |
@ts-charts/contour | Contour polygons and density estimation |
@ts-charts/delaunay | Delaunay triangulation and Voronoi diagrams |
@ts-charts/dispatch | Named event dispatching |
@ts-charts/drag | Drag-and-drop interaction |
@ts-charts/dsv | CSV and TSV parsing and formatting |
@ts-charts/ease | Easing functions for transitions |
@ts-charts/fetch | Convenience wrappers for the Fetch API |
@ts-charts/force | Force-directed graph layout |
@ts-charts/format | Number formatting (SI, fixed, currency, etc.) |
@ts-charts/geo | Geographic projections and path generators |
@ts-charts/graph | Node-link graphs: force-directed rendering, plus a layered (Sugiyama) layout via @ts-charts/graph/layered |
@ts-charts/hierarchy | Tree, treemap, pack, and partition layouts |
@ts-charts/interpolate | Value interpolation for animations |
@ts-charts/path | SVG path serialization |
@ts-charts/polygon | Polygon area, centroid, convex hull |
@ts-charts/quadtree | 2D spatial indexing |
@ts-charts/random | Random number generators for various distributions |
@ts-charts/scale | Scales: linear, log, ordinal, time, etc. |
@ts-charts/scale-chromatic | Color schemes: sequential, diverging, categorical |
@ts-charts/selection | DOM selection and manipulation |
@ts-charts/shape | Shape generators: line, area, arc, pie, stack |
@ts-charts/time | Time intervals and rounding |
@ts-charts/time-format | Date/time parsing and formatting |
@ts-charts/timer | Efficient animation scheduling via requestAnimationFrame |
@ts-charts/transition | Animated transitions on selections |
@ts-charts/zoom | Pan and zoom interaction |
Testing
bun testChangelog
Please see our releases page for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Community
For help, discussion about best practices, or any other conversation that would benefit from being searchable:
For casual chit-chat with others using this package:
Join the Stacks Discord Server
Postcardware
"Software that is free, but hopes for a postcard." We love receiving postcards from around the world showing where Stacks is being used! We showcase them on our website too.
Our address: Stacks.js, 12665 Village Ln #2306, Playa Vista, CA 90094, United States 🌎
Sponsors
We would like to extend our thanks to the following sponsors for funding Stacks development. If you are interested in becoming a sponsor, please reach out to us.
License
The MIT License (MIT). Please see LICENSE for more information.
Made with 💙
[codecov-href]: https://codecov.io/gh/stacksjs/ts-charts -->