Skip to content

compare/unified hover include all points at same coordinate - #4664

Merged
antoinerg merged 3 commits into
masterfrom
fix-4656
Mar 19, 2020
Merged

compare/unified hover include all points at same coordinate#4664
antoinerg merged 3 commits into
masterfrom
fix-4656

Conversation

@antoinerg

@antoinerg antoinerg commented Mar 19, 2020

Copy link
Copy Markdown
Contributor

Fixes #4656

Codepen: https://codepen.io/antoinerg/pen/gOpKwPg

First commit simply wrap existing logic into a function. Second commit changes the existing behavior.

@archmoj archmoj added the bug something broken label Mar 19, 2020
Comment thread src/components/fx/hover.js Outdated

// If in compare mode, select every point at position
if(hoverData[0].length !== 0 &&
['x', 'y'].indexOf(mode) !== -1 &&

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

concerning

['x', 'y'].indexOf(mode) !== -1 

creating a dynamic array of strings just for index checking might be slow.
Could we create a constant e.g.

var XY = ['x', 'y'];

at the upper scope and reuse that here?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or even var XY = {x: 1, y: 1} -> if(XY[mode]) 😅

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in b8b9395

Comment thread src/components/fx/hover.js
Comment thread src/components/fx/hover.js
@archmoj
archmoj requested a review from alexcjohnson March 19, 2020 20:31
Comment thread src/components/fx/hover.js Outdated

// Remove duplicated hoverData points
// note that d3 also filters identical points in the rendering steps
// TODO: use ES6 map

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we can make that a TODO just yet - perhaps if & when we convert the whole syntax to ES6 we can make sure we include polyfills for this and other feature, THEN we can use it whenever we wish...

@alexcjohnson alexcjohnson left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. Just a few nonblocking comments. 💃

@antoinerg

Copy link
Copy Markdown
Contributor Author

This looks great. Just a few nonblocking comments.

Great! I'll merge as soon as the tests pass

@archmoj

archmoj commented Mar 19, 2020

Copy link
Copy Markdown
Contributor

Nicely done!
💃 💃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug something broken

Projects

None yet

Development

Successfully merging this pull request may close these issues.

compare/unified hover should include all points at same coordinate

3 participants