VictoryAxis
For examples of VictoryAxis
in action, visit the Chart Axis guide.
Inherited Props
VictoryAxisCommonProps
VictorySingleLabelableProps
VictoryCommonProps
Component Props
crossAxis
The crossAxis
boolean prop specifies whether a given axis is intended to cross another axis. When this prop is true, zeroes will be removed from the array of ticks so that they do not clutter the origin of the chart.
When VictoryAxis
is nested within VictoryChart
, VictoryChart
will determine a value for the crossAxis
prop based on domain, but this prop may be overridden by supplying a crossAxis
prop directly to the VictoryAxis
child component.
domain
The domain
prop describes the range of data the component will include. This prop can be given as an array of the minimum and maximum expected values of the data or as an object that specifies separate arrays for x and y. If this prop is not provided, a domain will be calculated from data, or other available information.
The x
value supplied to the domain
prop refers to the independent variable, and the y
value refers to the dependent variable. This may cause confusion in horizontal charts, as the independent variable will corresponds to the y axis.
fixLabelOverlap
When true, this prop reduces the number of tick labels to fit the length of the axis. Labels are removed at approximately even intervals from the original array of labels. This feature only works well for labels that are approximately evenly spaced.
offsetX
The offsetX
prop defines how far from the edge of its permitted area an axis should be offset in the x direction. If this prop is not given, the offset will be calculated based on font size, axis orientation, and label padding. When VictoryAxis
is used with VictoryChart
, VictoryChart
will determine a value for offsetX
that makes the axes line up correctly, but this value may be overridden by supplying an offsetX
prop directly to the VictoryAxis
child component.
The offsetX
prop is relative to the edge corresponding to the orientation of the axis, e.g. the left edge when orientation="left"
.
<VictoryAxis dependentAxis offsetX={225} />
offsetY
The offsetY
prop defines how far from the edge of its permitted area an axis should be offset in the y direction. If this prop is not given, the offset will be calculated based on font size, axis orientation, and label padding. When VictoryAxis
is used with VictoryChart
, VictoryChart
will determine a value for offsetY
that makes the axes line up correctly, but this value may be overridden by supplying an offsetY
prop directly to the VictoryAxis
child component.
The offsetY
prop is relative to the edge corresponding to the orientation of the axis, e.g. the bottom edge when orientation="bottom"
.
<VictoryAxis offsetY={150} />
orientation
The orientation
prop specifies the position and orientation of your axis. Options are "top", "bottom", "left", and "right".
<VictoryAxis orientation="top" />