Paint the primitive. Should self-clip if it must stay inside the chart.
priceFormat is the chart's host-supplied price formatter (from
ChartConfig.priceFormat), so primitives that render a price label
(e.g. price lines) match the axis/crosshair formatting instead of
falling back to the library default.
OptionalpriceFormat: (price: number) => stringOptionalhitOptional pointer hit-test in CSS pixels. Used to route drags (e.g. a draggable price line). Return true if (x, y) lands on the primitive.
Optionaltolerance: number
A programmatic, host-driven overlay drawn at an explicit z-tier.
Distinct from Drawing: drawings are user-created interactive tools with undo/redo, snapshot persistence, selection handles, and a creation FSM, anchored in buffer space. Primitives are imperative overlays the host attaches/detaches directly (watermark, price lines, custom bands) — no undo, no persistence, just a draw at a chosen tier. The two deliberately share the
draw/hitTestshape so rendering helpers can be reused.drawreceives the same coordinate transforms as everything else (viewport.priceToY/indexToX), so primitives inherit price-scale-mode correctness (F1) for free.