Skip to content
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

histogram: in hover labels, harmonize start/end values of shared bins #4662

Merged
merged 2 commits into from
Mar 19, 2020

Conversation

antoinerg
Copy link
Contributor

@antoinerg antoinerg commented Mar 18, 2020

Fixes #4648

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

cc @nicolaskruchten | @plotly/plotly_js

roundFn = function(v, isRightEdge) {
return function() {
var roundFnOpts = gd._fullLayout._roundFnOpts[groupName];
return getBinSpanLabelRound(roundFnOpts.leftGap, roundFnOpts.rightGap, binEdges, pa, calendar)(v, isRightEdge);
Copy link
Contributor

Choose a reason for hiding this comment

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

This line is getting little too long. Maybe:

return getBinSpanLabelRound(
  roundFnOpts.leftGap, 
  roundFnOpts.rightGap, 
  binEdges, pa, calendar
)(v, isRightEdge);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in c387f9b

var roundFnOpts = {leftGap: Infinity, rightGap: Infinity};
if(groupName) {
if(!gd._fullLayout._roundFnOpts[groupName]) gd._fullLayout._roundFnOpts[groupName] = roundFnOpts;
roundFnOpts = gd._fullLayout._roundFnOpts[groupName];
Copy link
Contributor

Choose a reason for hiding this comment

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

Non-blocking,
We could rewrite this:

if(!gd._fullLayout._roundFnOpts[groupName]) {
  gd._fullLayout._roundFnOpts[groupName] = roundFnOpts;
}
roundFnOpts = gd._fullLayout._roundFnOpts[groupName];

to make it easier to read 3 gd._fullLayout._roundFnOpts[groupName].

@archmoj
Copy link
Contributor

archmoj commented Mar 19, 2020

This branch is little behind the master.
To help Q&A it may be a good idea to merge the master into this branch.

@archmoj
Copy link
Contributor

archmoj commented Mar 19, 2020

Screenshot from 2020-03-18 20-43-44

@antoinerg
Copy link
Contributor Author

This branch is little behind the master.
To help Q&A it may be a good idea to merge the master into this branch.

Is there anything that landed on master that is related to histogram?

Copy link
Collaborator

@alexcjohnson alexcjohnson left a comment

Choose a reason for hiding this comment

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

💃 LGTM!

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.

stacked histograms have different start/end values on hover
3 participants