PitchKit
API Reference@pitchkit/coreFunctions

layoutMomentumPanels()

function layoutMomentumPanels(
   ranges, 
   x0, 
   x1, 
   gap
): MomentumPanel[];

Defined in: packages/core/src/momentum/layout.ts:66

Lays periods out left to right across x0..x1, separated by gap.

Each panel's width is proportional to its minutes, so a minute is the same width in every period and a half with long stoppage time is wider rather than squeezed. If every range is empty the panels split the width equally, so a chart with no data still has somewhere to be.

The gap is clamped so it can never push a panel's width negative: a chart narrower than its own gaps collapses to zero-width panels rather than drawing itself inside out.

Parameters

ParameterType
rangesreadonly MomentumRange[]
x0number
x1number
gapnumber

Returns

MomentumPanel[]

On this page