-
-
Notifications
You must be signed in to change notification settings - Fork 530
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
Implement Widget.from_values #7033
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7033 +/- ##
==========================================
+ Coverage 86.25% 86.78% +0.53%
==========================================
Files 346 346
Lines 52052 52216 +164
==========================================
+ Hits 44897 45318 +421
+ Misses 7155 6898 -257 ☔ View full report in Codecov by Sentry. |
This is a good start towards #7003; thanks! A few questions:
|
Honestly, while that's the logic for something like
Afaik, that isn't the case. It's no cheaper than doing the individual queries.
Will take a look. |
Hmm. I think I'd typically rather have a middle value mainly because choosing the lower or the upper seems arbitrary, and is also by definition an extreme value. Still, I guess it's not worth a lot of extra work. Plus using a midpoint could be problematic in some cases, e.g. when only a finite enumerable list of values is allowed, without values in between.
Drat. I saw some docs that implied they were performed together, but it didn't actually state that explicitly, and briefly clicking around in the source code suggests that it's decomposed into a separate call per agg function. Alas! You do need to run |
I can think of quite a few common scenarios the middle value is arbitrary and the lower bound isn't. One relatively common case is when filtering where you treat the single value slider as a |
471f265
to
f959255
Compare
I think filtering should normally be done with a range widget (where there is no notion of a middle value), as discussed in #7003 (comment) and #7033 (comment) . In fact I suspect that filtering is the most typical and common use for this functionality, so I'd argue that returning a range widget by default is appropriate. In that case, a user will need to be explicit about requesting a single-value widget instead, and once they do that they might well be expected to specify explicitly that they want a midpoint default anyway. |
In a side channel, @philippjfr pointed out that this particular code is only called once a concrete widget type has been selected, i.e. it's Still, I defer to Philipp here, since (a) computing the midpoint isn't free, (b) computing the midpoint can be ambiguous (e.g. should it be the actual midpoint (which might not be a valid value or one that exists in this dataset), or should it be the nearest value actually existing in this dataset, and (c) Philipp is the one implementing it and using more than I am. :-) |
Thanks for summarizing that here so it's recorded. |
Implements #6071