New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Brush
component ignores passed startIndex
/ endIndex
params in Charts with syncId
#4163
Comments
Thanks for this, will look when I get a chance |
Okay so my recent change to fix this fixed a partial problem but not all of it. Here if you update the indices via inputs, everything updates correctly. However if you update state via the onChange function, the chart updates but the Brush does not. Suspect its a simple fix somewhere in the same place as #4034 Feel free to submit a PR, otherwise I'll take this when I can |
this is unfortunately more daunting than meets the eye, not a good first issue. You can semi-fix the problem by always incrementing updateId here https://github.com/recharts/recharts/pull/4034/files#diff-aa1b4fbed632e1bdab786e0521346d3a1a2386c633f22f5778d4bcbc47581a65R1292 but that adds more issues than it solves. |
I could "fix" this, but it breaks draggability of the Brush handles because of too many re-renders synced-brush-issue-recharts.mov |
Reproduction link
Steps to reproduce
Top and bottom charts are synced.
Drag the top (blue) brush to change its range:
New
startIndex
/endIndex
params are saved in the state and passed to the bottom (green) brush component.Even though new
startIndex
/endIndex
params are passed, nothing happens.The previous range is still displayed on the bottom (green) brush.
What is expected?
All brushes in synced charts need to be updated when one of them changes.
Or make sure that
Brush
component respects passedstartIndex
/endIndex
params and updates whenstartIndex
orendIndex
changesWhat is actually happening?
startIndex
/endIndex
values are ignored. Previous range is displayed in the second brush. Brushes are out of sync.Related:
#3027
The text was updated successfully, but these errors were encountered: