-
-
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
234 range selection with plotly
#289
234 range selection with plotly
#289
Conversation
Update: made a breakthrough in hyperreactivity and disabling. It's not quite ready but getting somewhere. |
This is so cool!!! I will make my obligatory comment about not hard-coding colors ;) but that's out of scope for this. The only real things I see are
These are probably pretty obvious though and because this is a WIP. I can see this feature is going to be useful and cool. Update: I think it would be a good idea to make this a stand-alone widget, maybe in |
…ter_panel_refactor@main
Duly noted, the colors used here are placeholders.
I will try to optimize this but it may be necessary, actually, because the plot in
Hmm, that's certainly something to think about. Thanks, @asbates! |
Truly great stuff! Played around with this a bit more and found an interesting behavior. Here's a video where I press down in the max range input box several times rapidly. Screen.Recording.2023-05-25.at.2.03.29.PM.mov |
@chlebowa I have implemented a debounce of 500ms for the input$selection_manual. Additionally, I have replaced the modal with a popover (which can alternatively be replaced with a tooltip). Initially, I attempted to address the issue by creating a separate JavaScript (JS) file named "popover.js" and calling it within the "filterState" function using the "include_js_files" method. However, I encountered a problem where the popover functionality only applied to the first defined help link, while the others did not display the popover. To overcome this issue, I decided to keep the script inline within the HTML code. LEt me know you thoughts and suggestions --------- Signed-off-by: kartikeya kirar <[email protected]> Signed-off-by: Aleksander Chlebowski <[email protected]> Co-authored-by: kartikeya <[email protected]> Co-authored-by: Aleksander Chlebowski <[email protected]> Co-authored-by: Aleksander Chlebowski <[email protected]>
Debouce functionality for range numeric input and popover is added in place of modal pop-up. |
…b.com:insightsengineering/teal.slice into 234_range_selector@filter_panel_refactor@main
Many thanks to @m7pr for helping me figure out the source of persistent check notes. It appears that prefixed object names (
A workaround was used (with no explanation) whereby single functions from some packages were imported, e.g. |
Are you sure you are up to date? I get a clean pass. |
If the issue below will be solved in this PR please close as well |
The PR is now ready to merge so let's have a final round of review @lcd2yyz @m7pr @gogonzo @Melkiades (contributors have been omitted). |
.rectify_dependencies_check <- function() { | ||
dplyr::filter | ||
grDevices::rgb | ||
lifecycle::badge | ||
logger::log_trace | ||
plotly::plot_ly | ||
shinycssloaders::withSpinner | ||
shinyWidgets::pickerOptions | ||
teal.widgets::optionalSelectInput | ||
} |
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 don't understand this. Can you explain?
Do I understand properly that checks doesn't recognise usage of the functions in methods of R6 classes?
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.
That is exactly what happens.
If package
is listed in Imports
, (1) check looks through NAMESPACE
to see if there are any importFrom(package,<foo>)
statements or an import(package)
statement. If none are found, (2) check looks for package::*
calls in the code. If none are found again, (3) check throws the NOTE, which is banned by our CI.
Now, when package::*
statements are made within an R6
class, they are not registered. Since plotly
and shinycssloaders
were only used within RangeFilterState$server_inputs
, I kept getting
Namespaces in Imports field not imported from:
'plotly' 'shinycssloaders'
All declared Imports should be used.
if (values[1L] < private$choices[1L]) values[1L] <- private$choices[1L] | ||
if (values[2L] > private$choices[2L]) values[2L] <- private$choices[2L] |
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.
way better to remove values in remove_out_of_bound_values
instead of cast_and_validate
!
Thanks
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.
The values_adjusted
part removed from cast_and_validate
did have the effect of removing out of bound values, but it was mostly to match arbitrary numbers to slider ticks. Before contain_interval
was introduced a few months ago, remove_out_of_bound_values
was actually doing its job.
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.
It's amazing!
Thanks @gogonzo. I will add the detailed explanation of the dependency check issue to comments in |
#' @importFrom dplyr filter | ||
#' @importFrom ggplot2 ggplot | ||
#' @importFrom grDevices rgb | ||
#' @importFrom lifecycle badge |
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.
respect for deleting all those @impoftFrom functions lol
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.
Although my contribution was minimal, I must acknowledge that the overall work done by Aleks is truly amazing.
Closes #234
Closes #233
Replaces the range slider in
RangeFilterState
with an interactiveplotly
graph. Two shapes (lines) are drawn on the plot that can be dragged and their position is tracked. An observer listens to events emitted by the plot when shapes are altered (this event is called a "plotly_relayout") and updates selection. Another observer listens to the manual input and updates selection. Finally, a third observer listens to the selection and updates the manual input as well as the shapes on the plot.Since the graph is slower to render, a spinner is added to it to alleviate the negative effect on UX.
Numeric (manual) input is now displayed simultaneously with the graphic input, not alternatively.
Numeric input receives a debounce.
Use this application to test: