What DrawingTool.expand needs to size a default in chart units.

interface ExpandContext {
    barSeconds: number;
    visibleBars: number;
    fromPixel(at: ScreenPoint): null | DrawingPoint;
    toPixel(p: DrawingPoint): null | ScreenPoint;
}

Properties

barSeconds: number

Seconds between adjacent bars, so a default can span a sane bar count.

visibleBars: number

Bars currently on screen. A default sized in fixed bars is a hairline when zoomed out and fills the pane when zoomed in, so size against this instead.

Methods

  • Anchor to media px on the placing pane, and back. Present when the host can map coordinates, absent otherwise. A default sized in pixels (a position box 64 px of risk tall, 150 px wide) reads the same at every zoom and on every instrument, which a price percentage cannot: 1% of a 2.87 stock and 1% of an index are the same fraction and very different boxes. Without the mapping a tool falls back to chart units.

    Parameters

    Returns null | ScreenPoint