useYAxisScale
Returns a function to convert data values to pixel coordinates for a YAxis. This is useful for positioning annotations, custom shapes, or other elements at specific data points on the chart. This hook must be used within a chart context (inside a LineChart, BarChart, etc.). Returns Available since Recharts 3.8undefined if used outside a chart context, or if the axes don't exist.
Related Links
Return value
ScaleFunction | undefined
A scale function that maps data values to pixel coordinates, or undefined.
Props
yAxisIdnumber | stringoptional
The
yAxisIdof the YAxis. Defaults to0if not provided.DEFAULT:
"defaultAxisId"