-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[charts-pro] Fix voronoi interaction with zoom #18950
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
Conversation
Deploy preview: https://deploy-preview-18950--material-ui-x.netlify.app/ Bundle size report
|
CodSpeed Performance ReportMerging #18950 will improve performances by 16.89%Comparing Summary
Benchmarks breakdown
Footnotes |
*/ | ||
startIndex: number; | ||
/** | ||
* The first index in the voronoi data that is outside this series. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: since this is called "endIndex", it should probably represent the last index, not the first one of the next series.
No need to fix it now as it is already like this and I might need to change it for the performance improvement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's to have the same behavior as the slice(start, end)
method. start
is included, and end
is excluded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but at the moment it seems the end
is included?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be clearer if I use the same expression as in the slice()
docs from MDN?
* The first index in the voronoi data that is outside this series. | |
* The index at which the series end in voronoid data. | |
* Ends up to but not including `endIndex`. |
Fix #18908
The issue came from a trick that works for static charts but not zoom ones.
To avoid having to manage coordinates all points outside of the drawing area were moved to a "trash coordinate" at (-drawing_width, -drawing_height) such that any moint inside the drawing area will be closer to the pointer than the trash coordinate.
Here is an illustration of the transformation where from the real data (the left chart) we move all points outside the drawing are (black rectangle) to the trash point (the red one) and give this representation to the delauney computation
If you have no data in the drawing area, the closer point is the trash point which contains all the scatter point. So Delauney retruns the first data point.
This PR effectively remove the data point that are outside of the drawing area and store an index mappping from delauney to series