Distributions: Fix invalid selection and tooltip for some histograms #7113
+44
−14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
Fixes #7102.
When all instances in a particular bar had the same value (up to the precision shown in the label), bars were shifted for one-half width to the left for cleaner visualization.
However, the position of the bar was then used to determine the bin thresholds, hence shifting it into the previous bin.
I also strongly suspect that padding between bars also caused some instances to be skipped in other histograms, too.
Description of changes
Although we could "unoffset" the bar, a cleaner solution is to store the actual range into each bar to make it independent of visualization, that may include other offsets and paddings in the future.
Unrelated: I cleaned the code so that is consistently uses
_is_last_bar
method, and I also addedis_first_bar
(however trivial it is) to make call arguments easier to understand.Includes