The Y axis of a Cartesian chart.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/recharts/recharts/llms.txt
Use this file to discover all available pages before exploring further.
Usage
Props
The key of a group of data which should be unique in a chart.
If not specified, the values from graphical components are used.
Unique ID that represents this YAxis.
Required when there are multiple YAxes.
The type of axis.
category: Treats data as distinct values. Each value is in the same distance from its neighbors, regardless of their actual numeric difference.number: Treats data as continuous range. Values that are numerically closer are placed closer together on the axis.auto: the type is inferred based on the chart layout.
Specify the domain of axis when the axis is a number axis.If undefined, then the domain is calculated based on the data and dataKeys.The length of domain should be 2, and we will validate the values in domain.Each element in the array can be a number, ‘auto’, ‘dataMin’, ‘dataMax’, a string like ‘dataMin - 20’, ‘dataMax + 100’,
or a function that accepts a single argument and returns a number.
When domain is specified, whether to allow data points outside of the domain.
Allow decimals in ticks.
Allow duplicate category values.
Width of the axis in pixels.
auto will attempt to resize the axis based on its content.The orientation of axis.
Axis padding is the distance between the edge of plot area and the first/last tick.
Scale function determines how data values are mapped to visual values.
In other words, decided the mapping between data domain and coordinate range.If undefined, or ‘auto’, the scale function is created internally according to the type of axis and data.You can define a custom scale, either as a string shortcut to a d3 scale, or as a complete scale definition object.
The name of axis data.
The unit of axis data.
If true, the axis will not be rendered.
If true, the axis will be reversed (rendering from top to bottom).
If true, hidden graphical items will be included in the axis domain calculation.
Tick props
Defines how the individual label text is rendered.
This controls the settings for individual ticks; on a typical axis, there are multiple ticks, depending on your data.If you want to customize the overall axis label, use the
label prop instead.Options:false: Do not render any tick labelstrue: Render tick labels with default settingsobject: An object of props to be merged into the internally calculated tick propsReactElement: A custom React element to be used as the tick labelfunction: A function that returns a React element for custom rendering of tick labels
Ticks can be any type when the axis is the type of category.
Ticks must be numbers when the axis is the type of number.
The count of ticks on the axis.
The formatter function of tick.
If set 0, all the ticks will be shown. If set “preserveStart”, “preserveEnd” or “preserveStartEnd”,
the ticks which is to be shown or hidden will be calculated automatically.
The minimum gap between two adjacent tick labels.
Whether to show tick line. If false or an object, tick line will be drawn with the props.
The length of tick line.
The margin between tick line and tick.
The angle of tick labels.
Specifies the font size of tick text.
If this prop is not specified, Recharts will read the default tick size from the DOM.Font size is used to calculate the width of the ticks, which in turn is used to determine how many ticks are rendered without overlapping.
Specifies the letter spacing of ticks.
This is used in conjunction with fontSize to calculate the width of the ticks.
If this prop is not specified, Recharts will read the default letter spacing from the DOM.Letter spacing is used to calculate the width of the ticks, which in turn is used to determine how many ticks are rendered without overlapping.
Controls how Recharts calculates “nice” tick values for this axis.@since 3.8
Style props
Determines how the axis line is drawn. Options:
true: the axis line is drawn with default propsfalse: the axis line is not visibleobject: passed as props to SVG<line>element representing the axis line
The label of axis. Can be text, or a Label component, or custom element.
If set true, flips ticks around the axis line, displaying the labels inside the chart instead of outside.
The stroke color of axis.
CSS class name for styling.
Source
https://github.com/recharts/recharts/blob/main/src/cartesian/YAxis.tsx