Optionalid: stringReadonlyidReadonlypointsStatic ReadonlyKBand half-width in standard deviations.
Static ReadonlyKINDTrue once a non-empty close series has been captured.
True once requiredPoints clicks have been collected.
True when the drawing's rendered geometry does NOT depend on its anchor
index/time — e.g. a full-width horizontal price level. Such drawings stay
visible (and selectable) under a replay cap even when their stored anchor
index sits past the revealed prefix, because the index is cosmetic for
them. Index/time-dependent drawings (the default) are hidden once every
anchor is past the cap, so a not-yet-revealed shape never leaks. Subclasses
whose render ignores the index override this to true.
Unique discriminator used in snapshots. Subclasses override.
How many clicks are needed before the drawing is "complete".
Add a point to the drawing if still incomplete. No-op otherwise.
Hit-test a screen point (in canvas pixels) against this drawing for
selection. Returns true when the point is within tolerance pixels of
the rendered geometry.
The default implementation treats the anchors as a polyline (correct for segment shapes like TrendLine and Arrow). Shapes whose rendered geometry differs from a simple anchor polyline — full-width/height lines, rectangles, rays, channels, fib levels — override this.
Render the drawing into the canvas.
Restore the numeric payload produced by snapshotData. Called by the snapshot factory after the anchors are populated. No-op in the base class.
Attach the candle-data source. Called by the host at creation time.
Provide the close samples directly. start is the buffer index of
samples[0]. Replaces any previously sampled/cached data.
ProtectedsnapshotOptional numeric payload persisted alongside the anchors. The base class emits nothing; subclasses that derive geometry from sampled data (regression channel) override this so the snapshot round-trips exactly. Mirrors restoreData.
Replace the last anchor — useful for "live preview" drag feedback.
Linear-regression channel — two anchor points delimiting an index span. A least-squares line is fitted to the
closevalues inside the span (the central line); parallel ±k·σ boundaries (k = 2 by default, the conventional regression-channel width) bracket it.Data access:
Drawing.render(ctx, layout, viewport, theme)has no candle buffer by design (anchors are the single source of truth for every other drawing). Rather than widen that signature, the channel keeps its ownsamplesarray — the closes of its span — populated once via a CloseSampler the host attaches at creation, or via setSamples/snapshot restore. The samples persist in the drawing snapshot (data), so a reloaded channel reproduces the exact same fit with no buffer present.Anchors carry only the span (
index); theirpriceis used solely as a fallback center line when no samples are available yet (e.g. a span entirely outside the loaded buffer), so the drawing degrades to a plain segment instead of vanishing.