Anchor to reality.
Points, boxes, DOM ranges, chart marks and diagram edges become anchors for shared annotation data.
OPEN SOURCE / HEADLESS TYPESCRIPT
Annotations that know where to go. Attach notes to actual chart marks, diagram nodes, DOM regions and reports—without giving up control of rendering or application state.
DOM-free core · Collision-aware layout · Optional adapters
01 / INTERACTIVE
This is the actual annotation layout engine—not a prerecorded animation. Change the conditions and watch it recalculate.
Swipe sideways or use the arrow keys to explore the full annotation chart.
SAME INPUTS / TWO METHODS
Computing the comparison…
Both methods use this engine and the same notes, anchors and obstacle. Scores are relative layout heuristics; overlap area is measured in chart coordinates, not display pixels. Fixed offsets are an illustrative baseline, not another library.
02 / THE BOUNDARY
Bring geometry from the thing you already render. Receive deterministic placements, paths and a scored quality report.
Points, boxes, DOM ranges, chart marks and diagram edges become anchors for shared annotation data.
Explore candidate placements, avoid known obstacles, and route connectors around crowded regions.
Output SVG, use React components or draw the geometry yourself. Application state remains yours.
03 / REAL EXAMPLES
Every example runs real repository code. Open the demo, examine the source, and bring the same patterns to your host.
TRY INTERACTIVE AUTHORING
The static examples show placement. These runnable React demos show what happens while an actual host changes the geometry.
REACT / INCREMENTAL EDITING
Preview a pointer movement immediately; calculate the final, authoritative layout only when the edit is committed.
REACT / WEB WORKER
Resolve layouts off the main thread. Try a newer request, reject an obsolete result, or ignore a pending reply.
Both integrations keep annotation state, scheduling and persistence in the host. Neither requires a package-owned Worker or editor framework.
SVG / HEADLESS
REACT FLOW
VEGA / VEGA-LITE
MERMAID
04 / GET STARTED
Use the headless core, pass host coordinates, and choose a renderer. Optional adapters stay opt-in.
npm install @ponchia/annotations@0.9.1
Start with an existing SVG or a measured DOM box. The same model supports every optional adapter.
import {
resolveAnnotationLayout,
renderAnnotationsSvg
} from '@ponchia/annotations';
import '@ponchia/annotations/bronto.css';
// Add <div id="chart-annotations"></div> inside your chart.
const layout = resolveAnnotationLayout({
annotations: [{
id: 'peak',
anchor: {
type: 'point',
point: { x: 280, y: 90 }
},
note: { title: 'Peak response' },
placement: { side: 'right' }
}],
bounds: { x: 0, y: 0, width: 640, height: 360 }
});
const svg = renderAnnotationsSvg(layout, {
title: 'Chart notes',
noteTabIndex: 0,
preserveAspectRatio: 'xMidYMid meet'
});
const target = document.getElementById('chart-annotations');
if (!target) throw new Error('Missing #chart-annotations mount');
target.innerHTML = svg;