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

DatetimeSlider and other missing widgets #1972

Open
jbednar opened this issue Feb 10, 2021 · 1 comment
Open

DatetimeSlider and other missing widgets #1972

jbednar opened this issue Feb 10, 2021 · 1 comment
Labels
type: feature A major new feature
Milestone

Comments

@jbednar
Copy link
Member

jbednar commented Feb 10, 2021

Panel widgets are tied to a specific Python datatype (int, float, etc.) and various modes of interaction (slider, text box, etc.), but not all combinations are covered by existing widgets (with missing ones indicated with a ?):

slider input player rangeslider rangeinput
int IntSlider IntInput Player Intrangeslider IntrangeInput?
float FloatSlider FloatInput Options for Player? Rangeslider FloatrangeInput?
date Dateslider DateInput? Options for Player? Daterangeslider DaterangeInput?
datetime Datetimeslider? Datetimeinput Options for Player? Datetimerangeslider? Daterangetimeinput
categorical DiscreteSlider (Autocompleteinput) DiscretePlayer (Multiselect) N/A?

My immediate use case is for a Datetimeslider, so that I can scroll through a point in time the same way I can scroll through a floating-point value. Any workaround I can think of seems very painful: Floatslider with a formatter to show as a date (awkward to work with, imprecise), DatePicker plus a time-of-day slider (hard to lay out, requires resetting time slider each midnight), DateSlider plus a time-of-day slider (requires resetting time slider each midnight).

Other missing widgets also seem useful, though the workarounds seem better in those cases: you can use two IntInputs or FloatInputs as an IntrangeInput or FloatrangeInput (though without inherent validation for ordering), you can use a Multiselect to select a range of discrete values (though without enforcing it to be a contiguous range necessarily), etc.

Would it be possible to simply dispense with having all these combinations and have a type argument for the widget instead? E.g. single Slider, Input, Player, RangeSlider, and RangeInput widget classes that can be configured as int, float, date, or datetime? Even better, they could deduce their type from the initial value, if not specified, which would leave things quite a bit cleaner in user code. Seems like this approach would also make it easier to find stuff in the reference guides (easily landing on the page about sliders if I want a slider).

[Not sure if Discrete fits into this categorization, really; Discrete isn't a datatype per se (though it's an assumption that allows you to be independent of datatype by accepting "List of x" for any x), and arguably range sliders and inputs are already covered for the discrete case by MultiSelect and similar widgets and by Autocompleteinput. But I figured I'd include that row in the table here just in case it resonated somehow. ETA: Renamed Categorical, and it does fit!]

@jbednar jbednar added the TRIAGE Default label for untriaged issues label Feb 10, 2021
@MarcSkovMadsen MarcSkovMadsen added type: feature A major new feature and removed TRIAGE Default label for untriaged issues labels Feb 22, 2021
@MarcSkovMadsen MarcSkovMadsen added this to the Wishlist milestone Feb 22, 2021
@jbednar
Copy link
Member Author

jbednar commented Jun 8, 2021

@jlstevens made a couple of useful observations here verbally today:

  1. The last row is really about categorical or nominal variables, rather than discreteness per se, because an integer value is also discrete but is already covered; what that row covers is selecting from a set that is not necessarily even ordered, just as for a categorical axis in Bokeh.
  2. Really there's a third dimension to the above table, as at least the first four rows can be split by whether they are continuous or discrete, with int and float being discrete or continuous numerical values and date and datetime being discrete or continuous temporal values. Yet more structure that we're not really acknowledging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature A major new feature
Projects
None yet
Development

No branches or pull requests

2 participants