ui.R

Let's start with the things to add to the ui.R. Once again, we add a place for the text to live to the graph tab:

tabPanel("Trend", plotOutput("trend"),
h3("User selection history"),
p(id = "selection", ""))

Then, we add a button to add the text and some controls to the sidebar:

actionButton("buttonClick", "Add inputs"),

selectInput("color", "Text colour",
c("Red" = "red",
"Blue" = "blue",
"Black" = "black")),

selectInput("size", "Text size",
c("Extremely small" = "xx-small",
"Very small" = "x-small",
"Small" = "small",
"Medium" = "medium",
"Large" = "large",
"Extra large" = "x-large",
"Super size" = "xx-large"))

The last addition is a reference to the JavaScript file that will make everything happen. We add this with the extendShinyjs() function. Put it underneath useShinyjs(), so you don't lose it:

useShinyjs(),
extendShinyjs(script = "appendText.js")

Let's look now at the server.R code.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset