Constructors

  • backend defaults to the 2D one so a pane built on its own (tests, a host composing panes by hand) paints the way it always has; the chart passes whatever its renderer option resolved to.

    Parameters

    Returns Pane

Properties

base: CanvasLayer
element: HTMLElement
top: CanvasLayer
weight: number = 1

Relative height weight within the chart (price=1, volume≈0.3).

Accessors

  • get backendDegradation(): null | RendererFallbackReason
  • Why the backend is painting through its 2D fallback rather than the path it was chosen for, or null. Read by the chart after each frame; the answer is a property of the device, so it is the same for every pane sharing it.

    Returns null | RendererFallbackReason

  • get priceScale(): PriceScale
  • The 'right' scale: the pane's primary axis, and the one a series maps to unless it names another. A getter over a field rather than a plain readonly property because moveSeriesScale swaps the two side scales, and the range, mode, margins, tick size and formatter all belong to the axis being moved.

    Returns PriceScale

Methods

  • Parameters

    • record: SeriesRecord

    Returns void

  • Autoscale each active price scale from its own series (independent axes).

    Parameters

    • ctx: PaneRenderContext
    • progress: number = 1

    Returns boolean

  • Scales configured with a visible column, including temporarily vacant ones. Hidden overlays are deliberately excluded from chart-wide axis settings.

    That scale is positioned by whoever created it and by nobody else. A volume histogram sitting in the bottom fifth of the price pane is an overlay with marginTop: 0.82, and a chart-wide plot-margin change that swept it up with the visible axes replaced that 0.82 with the dialog's number: the bars grew to fill most of the pane, and putting the dialog back where it started wrote 0.1, not the 0.82 nobody had recorded. Destructive and unrecoverable, from a control that only claims to move the plot inside its own axes.

    Returns PriceScale[]

  • Column x positions relative to the plot, shared by rendering and chart input. A collapsed pane has none: it draws no ladder, so no axis gesture may land on it.

    Parameters

    • ctx: PaneRenderContext

    Returns readonly PriceAxisSlot[]

  • Bind an attached primitive without detaching it. Null restores the right scale. The owner schedules layout and repaint after finishing its resource transaction.

    Parameters

    Returns boolean

  • Release every ratio lock on this pane (resetting the view drops them).

    Returns void

  • Detach every primitive (lifecycle cleanup) and remove the pane element.

    Returns void

  • True when a series or explicitly bound primitive uses the left axis.

    Returns boolean

  • Topmost primitive hit at media-px (x,y) relative to this pane's plot. except is left out, for the chart's corner mark, which yields to anything else at the point.

    What paints over the series (the overlay band and the front) beats what paints with or behind it (a drawing or a primitive placed in the series band, a drawing sent behind the series, a bottom primitive), whatever the distance: a box under an order line gives the press to the line, as the eye does. On either side the nearest wins, then the one painted later in band order, as bestHit ranks them. A hit painted by a primitive placed in the series band names it (paintedBy), so the chart can rank it against a series painted over it too.

    Two things keep a pointer move from asking every primitive. One that declares a hit box is skipped when the point is outside it; the boxes are kept while nothing they depend on changes (_checkHitBoxes). And the walk stops at an exact hit in the front band, which nothing after it can outrank: a later primitive would need a smaller distance than zero or a band above the front one, and the order the walk visits primitives in only ever breaks exact ties, which the first hit wins.

    Parameters

    • x: number
    • y: number
    • ctx: PaneRenderContext
    • Optionalexcept: null | IPrimitive

    Returns null | PrimitiveHit

  • Move one series to just before before, or to the end for null: the price source taking its place.

    Parameters

    • record: SeriesRecord
    • before: null | SeriesRecord

    Returns void

  • Move every series and bound primitive on one side to the other, axis and all.

    The two scale objects are swapped rather than their state copied across: the range, mode, margins, tick size and any custom formatter are all properties of the axis being moved, and copying would have to enumerate every one of them (and gain a field each time one is added). What is left behind carries nothing, so it is reset: keeping its range would label the vacated strip with a ladder for prices that are no longer on that side.

    Refuses when the target side already carries series or bound primitives. One side draws one axis, so a move onto an occupied side could only mean stacking two ladders in one strip or silently sending the sitting tenant the other way, and neither is what "move this axis to the left" asks for.

    Parameters

    • from: "left" | "right"
    • to: "left" | "right"

    Returns boolean

  • Paint background + grid + series + axes on the base canvas, or into target when given: the vector export runs this exact pass into a serialising context, so what it produces is the frame and not a re-description of it. Only the pane's own canvas is cleared first; a target starts empty by construction.

    Parameters

    • ctx: PaneRenderContext
    • Optionaltarget: CanvasRenderingContext2D

    Returns void

  • Whether primitive paints under record: in the band behind the series, or in the series band after an earlier series. The chart asks when a drawing and a series are both under the pointer, so the one painted on top takes the context menu.

    Parameters

    • primitive: IPrimitive
    • record: SeriesRecord
    • ctx: PaneRenderContext

    Returns boolean

  • Top (overlay) canvas: top-layer primitives + crosshair. Cheap repaint on cursor moves. cross.x is the shared plot x (vertical line, drawn in every pane for a global crosshair); cross.yLocal is the price-line y for the hovered pane only (null elsewhere); cross.showTimeTag draws the date tag on the bottom pane's axis strip.

    Parameters

    • cross: null | { showTimeTag: boolean; x: number; yLocal: null | number }
    • ctx: PaneRenderContext
    • Optionaltarget: CanvasRenderingContext2D

    Returns void

  • Media-px y of a price on this pane's readout scale. The inverse of yToPrice.

    Parameters

    • price: number

    Returns number

  • The entry a primitive is placed above, or null for one in its own band.

    Parameters

    Returns null | string

  • The scale a price quoted for this pane belongs to: the crosshair readout, the price on a click or a drag, and the chart's coordinate API all mean this one. It is the right scale in every layout that has not moved an axis.

    Returns PriceScale

  • Remove a series record if present; returns true if it was found.

    Parameters

    • record: SeriesRecord

    Returns boolean

  • Reorder a subset of series without disturbing unrelated sources.

    Parameters

    • ordered: readonly SeriesRecord[]

    Returns void

  • Parameters

    • width: number
    • height: number
    • dpr: number

    Returns void

  • The scale for an id, created if this pane has never used it. A host acting on one axis (a price-axis menu) needs the scale a side would use, not only the ones series happen to occupy. Unused scales retain their settings, while axis labels and columns follow the series that use them.

    Parameters

    Returns PriceScale

  • Every scale this pane has actually created. The left and overlay scales are built on demand, so a caller applying a pane-wide setting (plot margins, label precision) needs the live set rather than all three ids.

    Returns PriceScale[]

  • Swap the backend for the rest of the session: the old one releases its resources, the new one takes the base canvas and its context and is told the current size, so it is ready for the very next frame. The chart calls this for every pane at once when a GPU backend degrades, so a chart never paints half its panes one way and half the other.

    Parameters

    Returns void

  • Lay the pane out at a size without touching its canvases. The vector export paints at a size of the caller's choosing and then puts the live size back; resizing a canvas clears it, so going through resize would blank the screen until the next frame.

    Parameters

    • width: number
    • height: number

    Returns void

  • Paint an attached primitive in the series band, directly above the entry above names, instead of in its own z-order band; null puts it back. An entry with no series on this pane leaves it in its own band.

    Parameters

    Returns boolean

  • Pin (or release) the price-per-bar ratio of one scale, against the geometry in force right now. A locked scale is manual by definition: autoscaling it would re-fit the data every frame and undo the ratio being held.

    Locking a scale nothing has measured does nothing: there is no ratio to hold yet, and switching it to manual would strand it on the 0..1 placeholder with nothing left to measure it. Returns whether the scale ended up in the state asked for; releasing always succeeds.

    Parameters

    • id: PriceScaleId
    • on: boolean
    • barSpacing: number
    • plotHeight: number

    Returns boolean

  • Give every scale on this pane its plot height. Height is a layout property, but it used to be set only inside the autoscale pass, so any conversion between y and price before the first paint divided by zero and returned ±Infinity. Layout is when the height is actually known.

    Parameters

    • plotHeight: number

    Returns void

  • Draw the rule over this pane's top edge in color at device pixel ratio dpr, or none with a null colour.

    At a whole-number ratio it is the pane's 1 px top border, with the canvases starting under it: 1 px is whole device pixels there, and it is the layout, and the pane-local y, that every earlier release showed. At a fractional ratio a 1 px border is 1.25 or 1.5 device pixels, which starts the canvases part way into a pixel, and the browser then resamples the whole pane and blends the rule into it. There the rule is a box hairlineHeight(dpr) tall, one device pixel, laid over the canvases' first rows, and the canvases start on the pane's own top.

    Parameters

    • color: null | string
    • dpr: number

    Returns void

  • Name the chart's price source on this pane, or null when it is elsewhere or gone.

    Parameters

    • record: null | SeriesRecord

    Returns void

  • Active columns, nearest the plot first on each side. Vacant scales keep their rank.

    Parameters

    • emptyPriceAxis: boolean = true

    Returns readonly { order: number; scaleId: PriceScaleId; side: "left" | "right" }[]

  • Price at a media-px y on this pane (crosshair magnet, click/drag readout).

    Parameters

    • y: number

    Returns number