This PR adds code for hover bars over your SSP buttons.
The reason this was tricky is because radioButtons() has oneinputId, which is what gets referenced in our reactive server call. The function we were going to use, shinybs::bsPopover, linked the hover bar output to an inputId. So, we would have had one large text box when you moused over any SSP choice. Which works, but is quite clunky. We wanted to have explanations of each individual SSP, not one large explanation of all five of them.
The internet is our friend here. Here is a solution to our problem. This user created a function that essentially redefined another hover bar type function to accomplish the results we wanted - one inputId, but multiple hover bars over each selection option. (Just for the record, they submitted this as an official PR to Shiny as a feature suggestion, but the PR is six years old. This would have been really useful!)
So, the code here defines such a function (thank you, Stack Overflow) that allows us to maintain one consistent inputId such that our server code can still interpret an SSP input, but each choice has its own hoverbar.
Tasks for you to complete when you have the time (for ease, switch over to this branch and make changes here):
[ ] Please add a few more comments throughout your script for clarity, explaining why you're doing what you're doing. Some good places would be before your ui() code (as a mini intro) as well as throughout your server() code, and update lines 104 and 125
[ ] Remove any lines of code that have been commented out long ago, unless you still need them for reference
[ ] Add labels to your ggplot() (labs(x = "x label", y = "y label") is a good way to go) and tweak your title ("scenario" is appearing twice there)
[ ] Please modify the title arguments of each radioTooltip with your SSP explanations.
Let me know if any of this is unclear, if you have questions, or want to go through anything together. We also might need to make some design tweaks to the hover bars once your descriptions are in - whatever looks best to you.
Hi @BennettForville (and @bpbond):
This PR adds code for hover bars over your SSP buttons.
The reason this was tricky is because
radioButtons()
has oneinputId
, which is what gets referenced in our reactive server call. The function we were going to use,shinybs::bsPopover
, linked the hover bar output to aninputId
. So, we would have had one large text box when you moused over any SSP choice. Which works, but is quite clunky. We wanted to have explanations of each individual SSP, not one large explanation of all five of them.The internet is our friend here. Here is a solution to our problem. This user created a function that essentially redefined another hover bar type function to accomplish the results we wanted - one
inputId
, but multiple hover bars over each selection option. (Just for the record, they submitted this as an official PR to Shiny as a feature suggestion, but the PR is six years old. This would have been really useful!)So, the code here defines such a function (thank you, Stack Overflow) that allows us to maintain one consistent
inputId
such that our server code can still interpret an SSP input, but each choice has its own hoverbar.Tasks for you to complete when you have the time (for ease, switch over to this branch and make changes here):
ui()
code (as a mini intro) as well as throughout yourserver()
code, and update lines 104 and 125ggplot()
(labs(x = "x label", y = "y label")
is a good way to go) and tweak your title ("scenario" is appearing twice there)title
arguments of eachradioTooltip
with your SSP explanations.Let me know if any of this is unclear, if you have questions, or want to go through anything together. We also might need to make some design tweaks to the hover bars once your descriptions are in - whatever looks best to you.
Thank you!