Clip the context to an indicator sub-pane band — the building block for a
"pane primitive" (an overlay scoped to one sub-pane, e.g. a custom band on
the RSI pane). paneIndex is 1..paneCount (top→bottom); 0, an absent
pane, or a chart with no sub-panes clips to the main price area instead, so
a primitive that asks for a pane that isn't there degrades to the main pane
rather than vanishing. Call inside a ctx.save() / ctx.restore() pair.
A primitive paints in a pane by self-clipping here in its draw and
positioning with viewport.indexToX for X and the band's own
[top, bottom] for Y (sub-panes have independent Y scales, so use the band
bounds — not viewport.priceToY, which maps the main price axis).
Clip the context to an indicator sub-pane band — the building block for a "pane primitive" (an overlay scoped to one sub-pane, e.g. a custom band on the RSI pane).
paneIndexis1..paneCount(top→bottom);0, an absent pane, or a chart with no sub-panes clips to the main price area instead, so a primitive that asks for a pane that isn't there degrades to the main pane rather than vanishing. Call inside actx.save()/ctx.restore()pair.A primitive paints in a pane by self-clipping here in its
drawand positioning withviewport.indexToXfor X and the band's own[top, bottom]for Y (sub-panes have independent Y scales, so use the band bounds — notviewport.priceToY, which maps the main price axis).