Skip to content

Make the XAxis based hover/tooltip pick the item at the same x-axis v…#2980

Merged
simonbrunel merged 3 commits intochartjs:masterfrom
jeffesp:master
Jul 27, 2016
Merged

Make the XAxis based hover/tooltip pick the item at the same x-axis v…#2980
simonbrunel merged 3 commits intochartjs:masterfrom
jeffesp:master

Conversation

@jeffesp
Copy link
Contributor

@jeffesp jeffesp commented Jul 15, 2016

Intended to fix #2922 - even though it is closed, it looks like that might have been an error.

I reformatted this code as well as doing the fix. Sorry about that. If you want two commits, I can but this was all indented with spaces when I got it and it looks like every thing else uses tabs.

The key to this fix is in lines 453-459 where I look for the item by it's x value rather than by the index of the point in the data set.

@jeffesp
Copy link
Contributor Author

jeffesp commented Jul 27, 2016

It looks like the failure above is due to the CI server rather than the code. All tests pass for me. Can this be merged?

@etimberg
Copy link
Member

I think this is fine to merge.

CC @simonbrunel @zachpanz88

if (found._model.x === it._model.x)
item = it;
};
meta.data.forEach(findByXCoord);
Copy link
Member

Choose a reason for hiding this comment

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

We shouldn't iterate other all items here, but break as soon as one is found. You should maybe use a for loop or the helpers.findIndex instead.

@simonbrunel simonbrunel merged commit 1e5cdc6 into chartjs:master Jul 27, 2016
@simonbrunel
Copy link
Member

Sorry, merged before getting @zachpanz88 feedback, hope it's good for you :)

Thanks @jeffesp.

@jeffesp
Copy link
Contributor Author

jeffesp commented Jul 27, 2016

Sure. Thanks for the good feedback on using findIndex. Let me know if there's anything else to do here.

@panzarino
Copy link
Contributor

No worries, it looks good to me

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Point match wrong using two datasets with different length

4 participants