useXAxisScale
Returns a function to convert data values to pixel coordinates for an XAxis.
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 undefined if used outside a chart context, or if the axes don't exist.
Available since Recharts 3.8
Return value
ScaleFunction | undefined
A scale function that maps data values to pixel coordinates, or undefined.
xAxisIdnumber | stringoptional
The
xAxisIdof the XAxis. Defaults to0if not provided.DEFAULT:
"defaultAxisId"