Invert d3 scaleBand
This example demonstrates how to invert a `d3.scaleBand` scale, allowing a pixel position to be mapped back to the corresponding categorical domain value. The code defines a custom `invert` method that calculates the band index by accounting for outer and inner padding, the step size, and the range’s direction. It uses the `d3-scale` API, specifically the scale’s `domain()`, `range()`, `paddingOuter()`, `paddingInner()`, and `step()` methods, to compute the result. The implementation handles both ascending and descending ranges, returning the appropriate category for any point in the range.