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

@antoinergantoinerg 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.

@archmojarchmoj added the bug something broken label Mar 19, 2020
Comment threadsrc/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.

varXY=['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
ContributorAuthor

Choose a reason for hiding this comment

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

Done in b8b9395

Comment threadsrc/components/fx/hover.js
Comment threadsrc/components/fx/hover.js
Comment threadsrc/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...

@alexcjohnsonalexcjohnson 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
ContributorAuthor

This looks great. Just a few nonblocking comments.

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

@archmoj

Copy link
Copy Markdown
Contributor

Nicely done!
💃 💃

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

Labels

bugsomething 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

@antoinerg@archmoj@alexcjohnson