Generated API reference for @rekhly/charts-2d →
@rekhly/charts-2dCartesian XY charts, plus bar, heatmap, polar, Smith, spectrogram, density map, oscilloscope, eye diagram, parallel-coordinate, linear-gauge, data-grid, and the categorical family (pie, donut, radar, gauge, funnel, pyramid, treemap, sankey). Draws only through the engine scene graph — never imports WebGL/WebGPU directly.
New to Rekhly? Start with the Getting started guide — it assumes no prior experience with this library.
npm install @rekhly/charts-2d
import { chartXY, chartBar, chartHeatmap, DashboardLayout } from "@rekhly/charts-2d";
const chart = chartXY({ container: "#chart" });
chart.addLineSeries().setData({ x, y });
chart.zoom(0.8); // keyboard: +/-
chart.pan(24, 0); // keyboard: arrow keys
chart.resetView(); // keyboard: 0 / Home
chartXY / XYChart — axes, series (line/area/bar/scatter/vector/…), cursor, zoom/pan/reset with built-in keyboard navigation (via @rekhly/a11y), plus FacMarker-style markers (symbol / cursor / display-line / range / delta), limit lines, detection bars, and annotations — see Configuring components and the Markers guide.
chartBar, chartHeatmap, chartPolar, chartSmith, chartSpectrogram, chartDensityCurve, chartDensityScatter, chartOscilloscope, chartEyeDiagram, chartParallel, chartLinearGauge, chartDataGrid.
chartPie, chartDonut, chartRadar, chartGauge, chartFunnel, chartPyramid, chartTreemap, chartSankey (the PartHost-backed categorical family).
DashboardLayout — CSS-grid host; setColumns() collapses to a single column on mobile widths (see @rekhly/react's <DashboardChart>).
chartXY ships with every optional visual system on: legend, hover tooltip, value markers, limit lines, detection bars, annotations, the zoom-restore button, and a bottom-center toolbar (Sweep Once / Sweep Continuously — each a toggle — / Zoom in / Zoom out — see chart.setSweepSource()). Turn individual ones off, start from a preset, or attach your own plugin — none of this requires forking the library:
import { chartXY, CHART_PRESETS } from "@rekhly/charts-2d";
// Only what you asked for: legend + markers + limit lines.
const chart = chartXY({
container: "#chart",
components: { legend: true, markers: true, limitLines: true, cursor: false },
});
// Or start from a named combination.
const dashboardTile = chartXY({ container: "#tile", components: CHART_PRESETS.legendOnly });
Full reference, the two-user walkthrough, and how to write a ChartPlugin: see the Components guide.
chart.markers.add({
id: "M1",
kind: "symbol",
shape: "triangle-down",
position: { mode: "absolute", x: 2.5, y: 0 },
line: "vertical",
token: "1",
draggable: true,
snapToSeries: series.id, // FollowY
followX: false, // default — Continuously does not yank X
formatLabel: (x, y) => `M1 (${x.toFixed(2)}, ${y.toFixed(2)})`,
});
position — only dragging moves them (snapToSeries still applies while dragging).
position.mode: "relative" on scrolling ring buffers so the locked marker stays on screen (pnpm example:long-buffer).
Details: Markers guide.
chart.setComponents({
overview: {
position: "bottom-right",
relativeWidth: 0.28,
relativeHeight: 0.22,
clickMovesViewport: true, // ClickZoomOverviewMovesViewport
},
});
After zoom, the cyan brush outlines the main viewport inside the overview plot. See Zoom Overview.
(createHostSurface in @rekhly/engine sets this up for all of them).
dispose() is a safe no-op the second time.Got any questions? I'm happy to help with products, licensing, and examples.