Pure geometry helpers for LanternUI charts: linear scaling, "nice" axis ticks, and SVG path building.
No rendering and no Phoenix here — numbers in, strings/lists out — so this module is easy to unit-test and reuse.
Summary
Functions
Closed area path: the line dropped to baseline_y and closed back to the start.
Build an SVG path d from pixel points [{x, y}].
"Nice" axis tick values covering [min, max] with roughly count ticks.
Round a coordinate to one decimal, as a number.
Map v from domain {d0, d1} onto range {r0, r1}.
Functions
Closed area path: the line dropped to baseline_y and closed back to the start.
Build an SVG path d from pixel points [{x, y}].
With smooth? true the path is Catmull-Rom smoothed (good for sparse series);
false draws straight segments (better at high density).
@spec nice_ticks(number(), number(), pos_integer()) :: [float()]
"Nice" axis tick values covering [min, max] with roughly count ticks.
Returns an ascending list of floats; the first and last entries define the padded ("nice") domain the caller should scale against.
Round a coordinate to one decimal, as a number.
Map v from domain {d0, d1} onto range {r0, r1}.
A degenerate domain (d0 == d1) maps to the range midpoint instead of dividing
by zero.