-
Notifications
You must be signed in to change notification settings - Fork 111
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
If min / max are the same, hide histo + legend, show value #1554
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1554 +/- ##
==========================================
+ Coverage 61.74% 66.98% +5.24%
==========================================
Files 36 72 +36
Lines 3568 5876 +2308
Branches 0 382 +382
==========================================
+ Hits 2203 3936 +1733
- Misses 1365 1849 +484
- Partials 0 91 +91
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am unclear why the toggle between single-value and multi-value (histogram) is based upon non-clipped values rather than clipped. Seems like clipped is the right range to use, as it more reliably tells you if the histogram is single-valued.
@@ -476,6 +476,8 @@ class HistogramBrush extends React.PureComponent { | |||
const unclippedRangeMaxColor = | |||
world.clipQuantiles.max === 1 ? "#bbb" : globals.blue; | |||
|
|||
const isSingleValue = unclippedRangeMin === unclippedRangeMax; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what behavior are you targeting when the user has clipped the range, so that it is all single-valued or NaN (clipped)? In this case, the NaN doesn't show up in the histogram, and the histogram will end up being single-valued.
So shouldn't the conditional be based upon the min/max of the clipped range, rather than the unclipped range?
@@ -115,7 +116,13 @@ class ContinuousLegend extends React.Component { | |||
d3.select("#continuous_legend").selectAll("*").remove(); | |||
} | |||
|
|||
if (colorAccessor && colorScale && colorScale.range) { | |||
if ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this would be a lot more readable if it was something like:
const range = colorScale?.range;
const [domainMin, domainMax] = colorScale?.domain?.() ?? [0, 0];
if (colorAccessor && colorScale && range && domainMin < domainMax) {
...
}
and then use those variables further down
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Co-authored-by: Severiano Badajoz <sbadajoz@chanzuckerberg.com>
…nto colinmegill/#1497-histo-zeros
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes #1497