Low-level SVG element builders.
Each builder returns an iodata fragment. The renderer composes fragments and only flattens to a binary at the very end, which keeps large plots cheap to construct.
The helpers in this module do not know about data or scales — they speak
only in pixel coordinates. Use Bland.Scale.project/2 first, then pass the
result in here.
Summary
Functions
Renders a keyword list or map of attributes into an SVG attribute string
suffix (" k1=\"v1\" k2=\"v2\""). Underscores in keys are converted
to hyphens so stroke_width: 1 becomes stroke-width="1".
Circle with center and radius.
Defs block — for <pattern>, <marker>, <clipPath> etc.
Wraps a %Bland.Figure{}-sized viewBox around a body of SVG fragments.
XML-escapes a string for safe insertion into element text or attribute values.
Group element with attributes.
Line from (x1,y1) to (x2,y2).
Formats a numeric value with up to 3 decimals, trimming trailing zeros.
General path from an SVG d string.
Polygon from a list of {x, y} tuples.
Polyline from a list of {x, y} tuples.
Rectangle.
Text element. content is written literally — escape it with escape/1
if it may contain user input.
Types
@type attrs() :: Enumerable.t()
@type iodata_frag() :: iodata()
Functions
Renders a keyword list or map of attributes into an SVG attribute string
suffix (" k1=\"v1\" k2=\"v2\""). Underscores in keys are converted
to hyphens so stroke_width: 1 becomes stroke-width="1".
Circle with center and radius.
Defs block — for <pattern>, <marker>, <clipPath> etc.
Wraps a %Bland.Figure{}-sized viewBox around a body of SVG fragments.
XML-escapes a string for safe insertion into element text or attribute values.
Group element with attributes.
Line from (x1,y1) to (x2,y2).
Formats a numeric value with up to 3 decimals, trimming trailing zeros.
General path from an SVG d string.
Polygon from a list of {x, y} tuples.
Polyline from a list of {x, y} tuples.
Rectangle.
Text element. content is written literally — escape it with escape/1
if it may contain user input.