Basic Example
The YAxis component provides a vertical axis for charts with automatic tick generation and labeling.
Axis Config
Properties related to the scale of an axis are set on the Chart component. This includes scaleType, domain, domainLimit, range, data, and categoryPadding.
Scale Type
YAxis supports linear (default) and log scale types. Both linear and log are numeric scales.
Domain
An axis's domain is the range of values that the axis will display.
You can pass in either an object (AxisBounds) with min and max properties (both optional), or a function that receives initial AxisBounds and returns an adjusted AxisBounds.
Domain Limit
You can set the domain limit to nice (default for YAxis) or strict. nice will round the domain to human-friendly values, while strict will use the exact min/max values from the data. See d3-scale for more details.
Range
An axis's range is the range of values that the axis will display in pixels. This is most useful for adjusting the sizing of the data inside of the chart's drawing area.
You can pass in either an object (AxisBounds) with min and max properties (both optional), or a function that receives initial AxisBounds and returns an adjusted AxisBounds.
Axis Props
Properties related to the visual appearance of the YAxis are set on the component itself. This includes position, showGrid, showLine, showTickMarks, size, tickInterval, ticks, tickLabelFormatter, and tickMarkSize.
Position
You can set the position of an axis to left or right (default).
When layout="horizontal", CartesianChart supports only one y-axis configuration.
Grid
You can show grid lines at each tick position using the showGrid prop.
You can also customize the grid lines using the GridLineComponent prop.
Line
You can show the axis line using the showLine prop.
You can also customize the axis line using the classNames and styles props.