Axis options
Options
Section titled “Options”Type: AxisOptions
AxisOptions is a union of:
LinearAxisOptionsTimeAxisOptionsCategoricalAxisOptions
Shared options
Section titled “Shared options”The following options are available on all axis types unless noted otherwise.
Type: string
Default: none
Label of the axis. Is used by the tooltip too.
showLabel
Section titled “showLabel”Type: boolean
Default: true
Whether the label should be rendered next to the axis.
If false, the label will still be rendered in the tooltip.
Type: "linear" | "time" | "categorical"
Required
Axis type. Selects the underlying scale and which of the options below apply.
dataKey
Section titled “dataKey”Type: string
Required
The key of the data that should be mapped to the axis.
domain
Section titled “domain”Type: unknown[]
Default: none
The domain of the axis. For concrete axis types, this is narrowed (see below).
showGrid
Section titled “showGrid”Type: boolean
Default: none
Whether grid lines should be shown. Grid lines are hidden unless you set this to
true.
Applies to: linear, time. Also ignored for time axes in bar charts,
because those are rendered as categorical axes.
tickFormat
Section titled “tickFormat”Type: string
Default: none
Format string for the axis ticks. Either a D3 format string or a time format string. Depending on the type of the scale.
Applies to: linear, time.
tickUnit
Section titled “tickUnit”Type: AxisUnit
Default: [null, null] (no prefix or suffix)
Unit (prefix, suffix) for the rendered ticks.
A tuple of [prefix, suffix].
E.g. for a currency format, the prefix could be $ and the suffix could be CHF.
The units are applied after tickFormat.
extendedFormat
Section titled “extendedFormat”Type: string
Default: none
Format string for values that are displayed in an extended format. E.g. when the value is displayed in a tooltip.
Applies to: linear, time.
extendedUnit
Section titled “extendedUnit”Type: AxisUnit
Default: none (falls back to tickUnit)
Unit (prefix, suffix) for values that are displayed in an extended format. E.g. in the tooltip.
A tuple of [prefix, suffix].
The units are applied after extendedFormat.
If not set, the tickUnit is used for the extended format as well.
Linear axis options
Section titled “Linear axis options”Type: LinearAxisOptions
Type: "linear"
Required
includeZero
Section titled “includeZero”Type: boolean
Default: true
Whether the axis should include zero in the domain. Has no effect when the domain is set or when the data has values that are smaller than zero.
domain
Section titled “domain”Type: [number, number]
Default: none
Fixed numeric domain.
Time axis options
Section titled “Time axis options”Type: TimeAxisOptions
Type: "time"
Required
domain
Section titled “domain”Type: [string, string]
Default: none
Fixed time domain boundaries.
tickInterval
Section titled “tickInterval”Type: "millisecond" | "second" | "minute" | "hour" | "day" | "week" | "month" | "year"
Default: none
Minimal interval for the ticks. Only used for time scales.
Has no effect when used on time scales in bar charts.
It guarantees that the ticks are at least this interval apart.
E.g. if the value is set to "month", the ticks could also be a year apart but not weeks. Depending on the available space.
Categorical axis options
Section titled “Categorical axis options”Type: CategoricalAxisOptions
Type: "categorical"
Required
domain
Section titled “domain”Type: string[]
Default: none
Fixed categorical domain.
Categorical axes do not support tickFormat, extendedFormat, or showGrid.