-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Let numeric input be set manually #226
Let numeric input be set manually #226
Conversation
When I ran cdisc app state didnt seem to change instantly. I changed the values and waited for the result and If I didn't focus on the summary I wouldn't have a clue that it didn't change the state yet. I see the point of the change and I think that it should be automatically switched back to slider when changes made - which suggests dropdown menu. Maybe unrealistic vision, but what about tooltip menu popping up when cursor is over slider elements |
What happens if you choose values manually which are between two steps of the slider or beyond the edges of the slider e.g. if you select [0.0000001, 0.0000002] - if you switch to the slider and then back again is everything intuitive? Similarly if you close the card and reopen it etc. I'd also add validation here (what happens if you select say "e" (which is allowed in a numeric input, not sure if it's allowed in a range input) or don't enter one/both of the values - does it behave sensibly? Also if changing the value by the api (e.g. to a value not selectable in the slider) does everything behave as expected? It might be worth using the example RangeFilterState app in the roxygen as a good place to test things |
So it is not intuitive that you have to click the box to enter values, and then unclick to apply changes. But generally I prefer this input box over window popping up, cause it is simplier (is it thou?) but does the trick. |
Seems to be working nicely now. One thing I don't like is the Enter range manually checkbox, I would rather it be a button labeled Switch to manual and Switch to slider or similar. Nik's comment on validation is a must now as anything not coercible to numbers will break the app. The question is: do we want to add Out of range values and values between slider points are handled sufficiently well now, I believe. The one thing that could be corrected is this: |
It is already there, near the date / datetime input. |
It's not in |
We should avoid teal.slice/R/FilterStateDate.R Line 357 in 17a8fc6
|
So |
Ok, now I see it being removed, but why exactly we should not return validate error from the FilteredData? |
When everything is set properly by the app developer it would be silly if filter-panel return errors when poor user would just change something in the way we didn't expected to do. Validate errors are wrong as every shiny process after filter-panel (teal and modules) should handle the case when data return error. Validate is fine within
It can stay - if it occurs it means it's our fold that we allowed user to select something wrong. |
You mean we should allow the user to crash the app with a single accidental keystroke? Once |
What I mean is exactly opposite, user shouldn't be able to break the app accidentally or intentionally. |
One can accidentally type "r" instead of "5" and |
I've made some updates. Instead of a checkbox, we now have a switch with a label. Not especially happy with the label text but it's what I could think of. I've also made some updates in terms of error handling/validation for manual inputs. In each of these cases, we show a notification and reset the input to the current state of the class.
The last one is probably the most controversial. I could see an argument for not doing this but I think we should. Otherwise we could have the slider set to one value and the manual inputs to another. In that case, what is the state of the class? I also view the slider as the main input so the manual input should be driven by that. Remember the slider has been there all along and the manual input is just an extra convenience. Another case is if my range is 0 to 5 say, and I set 0 to 0.00000001. If we allow that and don't show the notification, then $set_selected() actually changes this to 0 and again the input is out of sync with the class state which is misleading. I also think that doing different things for the manual inputs vs. the slider is out of scope for this issue. I think if we want different behavior than current, we should scope that out and be specific before implementation. |
Thanks @asbates for the updates!
I do have some concerns about this item though. What do you mean exactly by "option in the slider"? Does this mean I can only choose values marked by the tick marks (eg. -3.1, -2.5 etc)? Or do you just mean the entered number has to be somewhere within the slider range? One of the main reason to enable the manual range is to provide users with more precise control on the data they are filtering. For example, some key numbers for lab tests may have very specific thresholds and we need to enable the user to provide the exact cutoff (eg. normal ferritin level in female is 11-307, we cannot achieve precise filtering if the tick marks are at 300 and 320).
Agree! Opened a new issue here #231 |
(It seems I forgot to sent his last night.)
How about having a button for each version instead of one switch?
This is tricky. Since the slider ticks are not actual data points but prettified values, there is a mechanism whereby programmatic selection is corrected reset to the closest tick, so that the requested value is included in the subsetting expression. See I would be satisfied with |
Yes if you can't set a specific value using the range input then it's not really worth bothering with the range input therefore I think #231 is a high priority. We could even remove the slider input and just show the histogram (maybe with vertical lines showing the range selected) and the range input which would simplify things a lot... I assume my environment isn't set up properly as when I run the example app cdisc app #165 I get an error:
so haven't been able to test what happens if you try to enter a numeric value that doesn't match the slider stepsize - if it just gives an error - or changes the input value to make a stepsize without giving a notification as to why - then although this could be merged into the refactor branch I don't think it should be merged into main until #231 is done |
You may have to install |
Yup my environment wasn't happy - this looks good but if being released, I would, in the notification, imply that although right now the numeric value must match the slider values this will change soon as otherwise I suspect we'll have some unhappy users... |
@lcd2yyz For the color of the switch, I set it to be the "info" color as this made the most sense to me. This will also allow it to match whatever theme is set. I can change it to "primary" if you like. This would again make it change depending on the theme. I do want to note that for the slider color, it's histogram, radio button graphs, and other things, we aren't actually using the bootstrap theme. A lot of these items are hard-coded. So if the theme is different, these items will remain blue, and likely won't match the theme. Also I'm not 100% sure but I think the default Bootstrap colors are slightly different for different versions. In this case the colors won't match even if it's just a version change vs. a theme change. For the "option in the slider" I mean we set the manual numbers to numbers available in the slider. This is what I mean by having different behaviors for different inputs (slider vs. box). I can see wanting the numeric to stay the same but I think this is getting into details that should be in another issue. I may have missed it but this wasn't discussed in the issue this PR adresses. |
Yes exactly, the method $set_selected() adjust the values. So removing the check and notification if the manual input doesn't match slider ticks, the actual state may be different than what the user input. So maybe we remove the
Which input? The slider or the box? Do we handle this differently for the slider and the box? Wouldn't this be confusing for the user. I'm not sure if you're saying this, but we shouldn't assign to |
It would indeed. It sounds to me like we are wanting different behavior for different inputs. I don't think that is a good idea. Or at a minimum we clearly communicate this to the user. If we drop the slider, then we won't have to change the values in |
The If a user enters a value that's outside of the range or not within the One more route that I think we can explore is to replace If we want to give a total freedom for user to enter a range, then I like what @nikolas-burkoff suggested:
This would make things a lot simpler and we would only have one input to handle numeric ranges. @lcd2yyz |
The freedom to specify any numerical value for the manual input range is very important for this feature to be valuable - we definitely need to enable this. We need to move away from the "steps" restriction when switching to manual input, so I think providing the slider along with the manual input option will be a nice touch, because most users are familiar and accustomed to this type of UI for numerical ranges, and it's simply visually appealing. So I would strongly prefer to have both if possible. Maybe I don't have the full grasp of all the check/validation that goes on behind the scene.... but could we just use a pair of |
@nikolas-burkoff @chlebowa I fully support this idea. We can figure out range-shift later. At this moment I'm totally convinced with removal of the slider @lcd2yyz @donyunardi what do you think about the above proposal? |
Keep in mind if we remove the slider, then we should adjust our set_selected method. Because right now it alters the values it's given (sometimes). If we need the precision of numeric inputs, then we need to adjust set_selected. Otherwise it's misleading to users. |
I still stand by statement this is getting out of scope though. I suggest we either merge this PR and fix with another issue. Or ditch the PR altogether and make the issue clear with the intended behavior. |
Thanks all for thinking hard about potential solutions and coming up with the proposals! Sorry for what will be a long response, but hopefully it can add some new perspective to the problem at hand. @donyunardi and I had a long discussion and tested a few things this afternoon. I still feel quite strongly of having both slider and manual range input together. I understand the biggest challenge here is when user switches back and forth between the slider and numeric input. So below is an outline of what I would consider to be the ideal behavior when user interacts with this UI.
Another behavior @donyunardi and I discussed was user entering out-of-range values (compared to the range of available data) in the numeric input. For example, the observed min-max of the data is Lastly, I will leave the decision to merge or ditch this PR to Dony and the team, depends on whether some already-implemented functionalities can be repurposed for the desired UI behavior. |
I don't believe this is possible I'm afraid |
This may well be impossible. Slider ticks are calculated when the
This would be quite difficult, even if the above were possible.
I don't like this, and for several reasons.
This begs the question: when a range like that is set and it is scientifically meaningful, should that fact be included in the subsetting call for reporting purposes, whether or not any data is dropped out? I think we should discuss this as a separate issue, preferably with some end user input. |
Using plotly this is possible: The black lines here are draggable (sadly they are draggable vertically as well but I would hope that could be configured?) Separately the example here (after "After @ firmo23's edit:") is really nice
|
Oh, I assumed
|
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.
@donyunardi none of the solutions propositions us all. Discussion exceeds the issue requirements and disagreement make it hard to merge. Since @lcd2yyz wish to keep slider I propose to:
- Make a second attempt on the slider and ticks to find out if we can find robust solution - Issue would be to provide ticks to slider which can cover all possible data points (I'm sceptical if we can make it perfect and efficient in the same time).
- Research and present implementation of Nik's proposal of interactive histogram.
- If (1) is impossible we need a decision if we want to merge this PR or use (2)
- Accept the problems mentioned by developers and merge PR with values snapping to the nearest possible.
For 1, 2 we need a separate issue
P.S. I wonder how sliders are done in other applications (spotfire, tableau).
I agree with @gogonzo proposal. |
Update: we had a discussion today and decided to keep this functionality as is. We will present it to users and get their feedback. Then make adjustments if needed. I'm going to close this PR and open a new one based on the current filter panel refactor branch. |
Let's a numeric input be set via range slider or input boxes.
Closes #133