Expand description
Axis scales: the continuous, invertible warp from data space to scale space, plus tick generation and value formatting.
A Scale is the 2D-plot analogue of a D3 scale: it maps a value on
one axis from data space (what the app measures — a temperature, a
byte count, an epoch timestamp) to scale space (the linearized
coordinate the plot lays out in) and back. It is a power-user
primitive — pure, standalone, and usable without ever building an
El: an app composing a custom chart from the public
pieces (see docs/PLOT2D_PLAN.md, Layer 3) reaches for Scale directly.
§Why “scale space”
A plot pans and zooms by changing only a transform uniform, never
re-uploading the data (see the plan’s decision 2). That works because a
pan/zoom of the visible window is affine in scale space — including
for a logarithmic axis, where panning is affine in log(value) even
though it is not in value. So every Scale exposes a
forward/inverse warp; the plot
lays out, pans, and zooms in the forward (scale-space) coordinate and
only converts back to data space to label ticks and read out the
crosshair.
Scale::Linear and Scale::Time share the identity warp — time is
linear in epoch seconds — and differ only in how ticks are chosen and
formatted. Scale::Log warps through log.
Structs§
- Tick
- One axis tick: a position in data space and its formatted label.
Enums§
- Scale
- A continuous, invertible map from an axis’s data space to scale space, with tick generation and default value formatting.