ChartAxis
Axis and tick rendering sub-component. Extracts cartesian axis chrome (X+Y axes, grid lines, tick labels) from the chart family so polar/radar/gauge families do not inherit cartesian elements.
Structure
Anatomy
Visual breakdown of the component's internal structure with BEM class call-outs.
<origam-chart-axis> — 4 visible regions: Y axis line ①, X axis line ②, horizontal grid lines ③, and tick labels ④.- 1.origam-chart-axis__y-axis
- Left vertical axis line. Hidden when showAxis=false.
- 2.origam-chart-axis__x-axis
- Bottom horizontal axis line. Hidden when showAxis=false.
- 3.origam-chart-axis__grid
- Horizontal grid lines aligned with Y-axis ticks. Hidden when showGrid=false.
- 4.origam-chart-axis__tick-label
- X and Y axis tick labels formatted by xAxisFormat / yAxisFormat.
API
Props
All props accepted by this component, with their type, default value and description.
- plotrequired{ x0: number y0: number x1: number y1: number cx: number cy: number }
- Pixel coordinates of the plotting area's four corners plus centre. Comes verbatim from useChart().plot.value.
- ticksrequired{ x: Array<IChartTick> y: Array<IChartTick> }
- Tick descriptors for X and Y (primary left axis). Comes from useChart().ticks.value.
- secondaryYTicksArray<IChartTick>
- Tick descriptors for the secondary right Y axis. When provided, a second vertical axis is rendered on the right edge of the plot area.
- showAxisbooleantrue
- Render the four-corner axis frame and tick labels. When false, the component renders nothing.
- showGridbooleantrue
- Render horizontal grid lines under the plot area.
- xAxisFormat(value: string | number) => string
- Formatter applied to X-axis tick labels. Defaults to String(value).
- yAxisFormat(value: number) => string
- Formatter applied to Y-axis tick labels. Defaults to String(value).
- secondaryYAxisFormat(value: number) => string
- Formatter applied to the secondary (right) Y-axis tick labels. Falls back to yAxisFormat, then String(value).
Customisation
CSS variables
CSS custom properties exposed by this component. Override them to customise the component without losing theme compatibility.
- Axis line colour.
- Tick label text colour.
- Tick label font size.
- Grid line colour.
- Grid line stroke width.
Inclusion
Accessibility
ARIA roles, keyboard navigation and focus management. Sourced from the real component template.
ARIA roles
Notes
- ChartAxis is a purely decorative SVG sub-component with no interactive elements. Accessibility is handled by the parent chart container (role="img" with aria-label describing the data).
Foundation
Design tokens
Excerpt from this component's token declarations — the --origam-<component>---<property> variables, declared in its hand-maintained token sheet with no build step.
- colorvar(--origam-color__border---default)
- Axis line colour.
- colorvar(--origam-color__text---secondary)
- Tick label text colour.
- colorvar(--origam-color__border---subtle)
- Grid line colour.
- dimension1px
- Grid line stroke width.
Interactive
Playground
Edit props live and see the component update in real time. The generated code snippet updates as you change values.
This is an internal sub-part: it is injected by its parent component and cannot render on its own. See the parent component page for a live example.
Rendering the live preview…
Usage
Examples
Ready-to-paste code snippets for your templates.
Usage inside OrigamChartCartesian
Ecosystem
Family
Components from the same folder that share conventions and often compose together.