OPEN SOURCE / HEADLESS TYPESCRIPT

Explain what's already on the screen.

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

Placement, as it happens.

This is the actual annotation layout engine—not a prerecorded animation. Change the conditions and watch it recalculate.

LIVE GEOMETRYCOLLISION-AWARE
See the original chart, then compare placement methods. Hiding notes does not change the measured layout.
RESPONSE / NORMALIZED SAMPLE INDEX →

Swipe sideways or use the arrow keys to explore the full annotation chart.

LAYOUT SCORE—
NOTES PLACED—
NOTE OVERLAP—
OBSTACLE OVERLAP—

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.

CONFIGURE THE SCENE

Move the conditions.
Keep the context.

Compare a simple fixed-offset baseline with collision-aware placement using the same chart, notes and measured quality.

Start with a scene

Balanced: three callouts and a medium obstacle. Change any control to experiment.

Automatic placement searches alternatives to avoid crowding. Switch to fixed offsets to see the difference.

Read notes and inspect placement

Notes in this scene

    Measured placement findings

    No findings for this layout.

      These checks measure geometry and connector intersections. They do not certify text readability or accessibility. How quality is measured.

      Use this scene in your code

      Copy or download the parameters and annotation objects currently shown. This is the headless layout call; integrate the returned SVG into your own trusted rendering surface.

      Current playground settings

      Real resolveAnnotationLayout and renderAnnotationsSvg. Inspect source ↗

      02 / THE BOUNDARY

      You own the surface.
      We handle the callouts.

      Bring geometry from the thing you already render. Receive deterministic placements, paths and a scored quality report.

      ↗

      Anchor to reality.

      Points, boxes, DOM ranges, chart marks and diagram edges become anchors for shared annotation data.

      ▱

      Make room for meaning.

      Explore candidate placements, avoid known obstacles, and route connectors around crowded regions.

      ⌗

      Render your way.

      Output SVG, use React components or draw the geometry yourself. Application state remains yours.

      03 / REAL EXAMPLES

      See the annotations land.

      Every example runs real repository code. Open the demo, examine the source, and bring the same patterns to your host.

      TRY INTERACTIVE AUTHORING

      Move an annotation. Watch what stays put.

      The static examples show placement. These runnable React demos show what happens while an actual host changes the geometry.

      REACT / INCREMENTAL EDITING

      Drag a note without moving its neighbors.

      Preview a pointer movement immediately; calculate the final, authoritative layout only when the edit is committed.

      • Drag preview
      • Commit layout
      • Reuse placements

      REACT / WEB WORKER

      Keep the interface available during heavy work.

      Resolve layouts off the main thread. Try a newer request, reject an obsolete result, or ignore a pending reply.

      • Worker solve
      • Revision checks
      • UI ping

      Both integrations keep annotation state, scheduling and persistence in the host. Neither requires a package-owned Worker or editor framework.

      Annotations over a generated Vega visualization

      VEGA / VEGA-LITE

      Explain generated marks.

      Resolve annotated targets after the chart renderer produces its geometry.
      Annotations around Mermaid diagram elements

      MERMAID

      Turn diagrams into evidence.

      Explain rendered nodes and messages without owning the diagram language.

      04 / GET STARTED

      Plain objects in.
      Render-ready output.

      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.

      quick-start.ts
      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;