useYAxisInverseScale
Returns a function to convert pixel coordinates back to data values for a YAxis. 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 useYAxisInverseDataSnapScale. 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
yAxisIdnumber | stringoptional
The
yAxisIdof the YAxis. Defaults to0if not provided.默认值:
"defaultAxisId"