Avena Webapp API - v0.0.1
    Preparing search index...

    Function fitTimeTicks

    • Picks time ticks for an axis widthPx wide.

      Starts from about one tick per preferredSpacingPx. When that gives fewer than minTicks ticks (a narrow plot, where the 1-2-5 rounding can leave only the two ends), it tries denser steps and keeps the densest one whose labels still fit between neighbouring ticks with gapPx to spare, stopping once minTicks is reached. Labels never overlap: a denser step is used only if its widest label fits.

      Parameters

      • start: number

        Range start, seconds.

      • end: number

        Range end, seconds.

      • widthPx: number

        Width of the axis, CSS pixels.

      • measure: (label: string) => number

        Width of a label in CSS pixels, in the tick font.

      • options: { gapPx?: number; minTicks?: number; preferredSpacingPx?: number } = {}

        preferredSpacingPx (default 70), minTicks (default 4) and gapPx, the least space between two labels (default 12).

      Returns TimeAxisTicks

      The ticks, as from timeAxisTicks.