Composable SVG axis components for charts.
Each axis renders ticks, labels, and an optional title as SVG <g> groups.
They accept scale functions (from ChartScales) and tick values to position
elements — working both standalone and inside xy_chart.
Examples
<svg viewBox="0 0 400 300">
<.x_axis ticks={[0, 25, 50, 75, 100]} scale={scale_fn} y={260} width={340} />
<.y_axis ticks={[0, 50, 100]} scale={scale_fn} x={44} height={244} />
</svg>
Summary
Functions
Concentric circles axis for polar charts — renders value rings.
Angular axis for polar/radar charts — renders labels around a circle.
Horizontal axis with ticks, labels, and optional title.
Vertical axis with ticks, labels, and optional title.
Functions
Concentric circles axis for polar charts — renders value rings.
Attributes
ticks(:list) (required) - List of radial tick values.scale(:any) (required) - Scale functionfn(value) -> radius_px.cx(:any) (required)cy(:any) (required)label_format(:any) - Defaults tonil.class(:string) - Defaults tonil.
Angular axis for polar/radar charts — renders labels around a circle.
Attributes
labels(:list) (required) - List of category labels.cx(:any) (required) - Center X.cy(:any) (required) - Center Y.radius(:any) (required) - Radius for label placement.class(:string) - Defaults tonil.
Horizontal axis with ticks, labels, and optional title.
Renders a baseline, tick marks, and text labels at positions determined by the scale function.
Attributes
ticks(:list) (required) - List of tick values.scale(:any) (required) - Scale functionfn(value) -> pixel_x.y(:any) (required) - Y position of the axis line.width(:any) (required) - Width of the axis line.x_offset(:any) - X offset for the axis start. Defaults to0.tick_size(:integer) - Length of tick marks in px. Defaults to5.label_format(:any) - Optionalfn(value) -> stringfor labels. Defaults tonil.title(:string) - Optional axis title. Defaults tonil.position(:atom) - Defaults to:bottom. Must be one of:top, or:bottom.class(:string) - Defaults tonil.
Vertical axis with ticks, labels, and optional title.
Attributes
ticks(:list) (required)scale(:any) (required) - Scale functionfn(value) -> pixel_y.x(:any) (required) - X position of the axis line.height(:any) (required) - Height of the axis line.y_offset(:any) - Y offset for the axis start. Defaults to0.tick_size(:integer) - Defaults to5.label_format(:any) - Defaults tonil.title(:string) - Defaults tonil.position(:atom) - Defaults to:left. Must be one of:left, or:right.class(:string) - Defaults tonil.