Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(clipDot): proper defaults for r and strokeWidth when they aren't …
…provided by the user (#3624) <!--- Provide a general summary of your changes in the Title above --> ## Description <!--- Describe your changes in detail --> Basically https://codesandbox.io/s/simple-line-chart-forked-4gczxs?file=/src/App.tsx When `allowDataOverflow` is true on an axis and `clipDot` is false on a `dot` (in a Line or Area) without `r` or `strokeWidth` the calculations [here](https://github.com/recharts/recharts/blob/bf8d626c76c0534fd2a762c0859d6be9e1459e37/src/cartesian/Line.tsx#L468) cause `NaN` to be added on the `clipPath` and cause console errors. This is because the defaults just above that do not work if the user provides their own props for dot i.e. `dot={{ clipDot: false }}`. Fix this by defaulting the params to the same values they default to if the user provides no params. ## Related Issue <!--- This project only accepts pull requests related to open issues --> <!--- If suggesting a new feature or change, please discuss it in an issue first --> <!--- If fixing a bug, there should be an issue describing it with steps to reproduce --> <!--- Please link to the issue here: --> #3602 PR where this was merged, no issue yet. Follow up from release ## Motivation and Context <!--- Why is this change required? What problem does it solve? --> Fix bug released in 2.7 ## How Has This Been Tested? <!--- Please describe in detail how you tested your changes. --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> `clipPath` for dots has valid values and does not add attributes with NaN. * no more console errors * add unit test to confirm this for line ## Screenshots (if appropriate): <img width="505" alt="image" src="https://github.com/recharts/recharts/assets/25180830/b89acae0-db57-41d4-ab92-41fdc4b2a616"> ## Types of changes <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [Y] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) ## Checklist: <!--- Go over all the following points, and put an `x` in all the boxes that apply. --> <!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> - [Y] My code follows the code style of this project. - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - [Y] I have added tests to cover my changes. - [Y] All new and existing tests passed. Co-authored-by: Coltin Kifer <[email protected]>
- Loading branch information