Skip to content

scales

Scales, tick generation and number/date formatting for SVG charts.

Classes

Linear

Map a numeric domain onto a pixel range.

Functions:

nice_ticks(lo, hi, count=5)

Round tick values inside [lo, hi].

nice_max(hi, count=4)

Extend an upper bound to the next round tick (for zero-based axes).

fmt_num(v, step=0.0)

Compact numeric label: 1,234 / 12.5k / 3.4M / 0.25 / 1.2e-05.

to_seconds(values)

Convert datetimes / timestamps / numbers to float POSIX seconds.

date_ticks(lo, hi, count=6)

Calendar-aligned ticks between lo and hi (POSIX seconds).