Chart primitives
Layouts & specialized
Interactions
Data utilities
Umbrella package
@vx/axis
An axis component consists of a line with ticks, tick labels, and an axis label that helps viewers interpret your graph.
You can use one of the 4 pre-made axes, or you can create your own based on the <Axis />
element.
Note that the @vx/react-spring
package exports an AnimatedAxis
variant with animated ticks.
Installation
npm install --save @vx/axis
Examples
<Axis.AxisBottom />
<Shape.BarStack />
<Threshold />
Components
APIs
#<Axis />
The class name applied to the outermost axis group element.
The class name applied to the axis line element.
For more control over rendering or to add event handlers to datum, pass a function as children.
If true, will hide the axis line.
Default false
If true, will hide the ticks (but not the tick labels).
Default false
If true, will hide the '0' value tick and tick label.
Default false
The text for the axis label.
The class name applied to the axis label text element.
Pixel offset of the axis label (does not include tick label font size, which is accounted for automatically)
Props applied to the axis label component.
A left pixel offset applied to the entire axis.
Default 0
The number of ticks wanted for the axis (note this is approximate)
Default 10
Placement of the axis
Default Orientation.bottom
Pixel padding to apply to both sides of the axis.
Default 0
The color for the stroke of the lines.
The pattern of dashes in the stroke.
The pixel value for the width of the lines.
The class name applied to each tick group.
Override the component used to render tick labels (instead of <Text /> from @vx/text).
A d3 formatter for the tick text.
A function that returns props for a given tick label.
The length of the tick lines.
Default 8
((tickRendererProps: TicksRendererProps<Scale>) => ReactNode) | undefined
optional Override the component used to render all tick lines and labels.
The color for the tick's stroke value.
A custom SVG transform value to be applied to each tick group.
An array of values that determine the number and values of the ticks. Falls back to scale.ticks()
or .domain()
.
A top pixel offset applied to the entire axis.
Default 0
#<AxisBottom />
The class name applied to the outermost axis group element.
The class name applied to the axis line element.
For more control over rendering or to add event handlers to datum, pass a function as children.
If true, will hide the axis line.
If true, will hide the ticks (but not the tick labels).
If true, will hide the '0' value tick and tick label.
The text for the axis label.
The class name applied to the axis label text element.
Pixel offset of the axis label (does not include tick label font size, which is accounted for automatically)
Default 8
Props applied to the axis label component.
A left pixel offset applied to the entire axis.
The number of ticks wanted for the axis (note this is approximate)
Placement of the axis
Pixel padding to apply to both sides of the axis.
The color for the stroke of the lines.
The pattern of dashes in the stroke.
The pixel value for the width of the lines.
The class name applied to each tick group.
Override the component used to render tick labels (instead of <Text /> from @vx/text).
A d3 formatter for the tick text.
A function that returns props for a given tick label.
The length of the tick lines.
Default 8
((tickRendererProps: TicksRendererProps<Scale>) => ReactNode) | undefined
optional Override the component used to render all tick lines and labels.
The color for the tick's stroke value.
A custom SVG transform value to be applied to each tick group.
An array of values that determine the number and values of the ticks. Falls back to scale.ticks()
or .domain()
.
A top pixel offset applied to the entire axis.
#<AxisLeft />
The class name applied to the outermost axis group element.
The class name applied to the axis line element.
For more control over rendering or to add event handlers to datum, pass a function as children.
If true, will hide the axis line.
If true, will hide the ticks (but not the tick labels).
If true, will hide the '0' value tick and tick label.
The text for the axis label.
The class name applied to the axis label text element.
Pixel offset of the axis label (does not include tick label font size, which is accounted for automatically)
Default 36
Props applied to the axis label component.
A left pixel offset applied to the entire axis.
The number of ticks wanted for the axis (note this is approximate)
Placement of the axis
Pixel padding to apply to both sides of the axis.
The color for the stroke of the lines.
The pattern of dashes in the stroke.
The pixel value for the width of the lines.
The class name applied to each tick group.
Override the component used to render tick labels (instead of <Text /> from @vx/text).
A d3 formatter for the tick text.
A function that returns props for a given tick label.
The length of the tick lines.
Default 8
((tickRendererProps: TicksRendererProps<Scale>) => ReactNode) | undefined
optional Override the component used to render all tick lines and labels.
The color for the tick's stroke value.
A custom SVG transform value to be applied to each tick group.
An array of values that determine the number and values of the ticks. Falls back to scale.ticks()
or .domain()
.
A top pixel offset applied to the entire axis.
#<AxisRight />
The class name applied to the outermost axis group element.
The class name applied to the axis line element.
For more control over rendering or to add event handlers to datum, pass a function as children.
If true, will hide the axis line.
If true, will hide the ticks (but not the tick labels).
If true, will hide the '0' value tick and tick label.
The text for the axis label.
The class name applied to the axis label text element.
Pixel offset of the axis label (does not include tick label font size, which is accounted for automatically)
Default 36
Props applied to the axis label component.
A left pixel offset applied to the entire axis.
The number of ticks wanted for the axis (note this is approximate)
Placement of the axis
Pixel padding to apply to both sides of the axis.
The color for the stroke of the lines.
The pattern of dashes in the stroke.
The pixel value for the width of the lines.
The class name applied to each tick group.
Override the component used to render tick labels (instead of <Text /> from @vx/text).
A d3 formatter for the tick text.
A function that returns props for a given tick label.
The length of the tick lines.
Default 8
((tickRendererProps: TicksRendererProps<Scale>) => ReactNode) | undefined
optional Override the component used to render all tick lines and labels.
The color for the tick's stroke value.
A custom SVG transform value to be applied to each tick group.
An array of values that determine the number and values of the ticks. Falls back to scale.ticks()
or .domain()
.
A top pixel offset applied to the entire axis.
#<AxisTop />
The class name applied to the outermost axis group element.
The class name applied to the axis line element.
For more control over rendering or to add event handlers to datum, pass a function as children.
If true, will hide the axis line.
If true, will hide the ticks (but not the tick labels).
If true, will hide the '0' value tick and tick label.
The text for the axis label.
The class name applied to the axis label text element.
Pixel offset of the axis label (does not include tick label font size, which is accounted for automatically)
Default 8
Props applied to the axis label component.
A left pixel offset applied to the entire axis.
The number of ticks wanted for the axis (note this is approximate)
Placement of the axis
Pixel padding to apply to both sides of the axis.
The color for the stroke of the lines.
The pattern of dashes in the stroke.
The pixel value for the width of the lines.
The class name applied to each tick group.
Override the component used to render tick labels (instead of <Text /> from @vx/text).
A d3 formatter for the tick text.
A function that returns props for a given tick label.
The length of the tick lines.
Default 8
((tickRendererProps: TicksRendererProps<Scale>) => ReactNode) | undefined
optional Override the component used to render all tick lines and labels.
The color for the tick's stroke value.
A custom SVG transform value to be applied to each tick group.
An array of values that determine the number and values of the ticks. Falls back to scale.ticks()
or .domain()
.
A top pixel offset applied to the entire axis.