Skip to content

Combination of margin and domain being set causes active dot to appear outside graph #5086

@cameronm-orion

Description

@cameronm-orion

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

Given a LineChart with a numerical X axis, if a margin is set on the LineChart component and the domain is also set so that all dots are outside the domain, the active dot will appear outside the graph on hover.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via codesandbox or similar (template: https://codesandbox.io/p/sandbox/simple-line-chart-v25dl4).

I was able to reproduce the behaviour on the Recharts website https://recharts.org/en-US/examples/HighlightAndZoomLineChart with the following code https://pastebin.com/mFYKLpsZ. The initial state is the most relevant part.
image

What is the expected behavior?

The active dot should be hidden if no dots are within the viewbox.

Which versions of Recharts, and which browser / OS are affected by this issue? Did this work in previous versions of Recharts?

Tested in 2.12.7 and also used the Recharts website. Have used Chrome 129 on macOS 14.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugGeneral bug label

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions