useXAxisInverseScale
Returns a function to convert pixel coordinates back to data values for an XAxis. This is useful for implementing interactions like click-to-add-annotation, drag interactions, or tooltips that need to determine what data point corresponds to a mouse position. For continuous (numerical) scales, returns an interpolated value. For categorical scales, returns the closest category in the domain - which is the same behaviour as useXAxisInverseDataSnapScale. 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.
Return value
InverseScaleFunction | undefined
An inverse scale function that maps pixel coordinates to data values, or undefined.
Props
xAxisIdnumber | stringoptional
The
xAxisIdof the XAxis. Defaults to0if not provided.默认值:
"defaultAxisId"