library(shiny)
library(shinyRoughJS)
library(shinyCyJS)
library(shinyjs)
ui <- fluidPage(
shinyRoughJSOutput(outputId = 'cv'),
ShinyCyJSOutput(outputId = 'cy')
)
server <- function(input, output, session) {
output$cv = renderRough(
shinyRoughJS(
items = list(
# x,y,w,h
RoughRect(1,1,100,100,RoughOptions(fill='#fd79a8')),
RoughRect(101,1,100,100,RoughOptions(fill='#74b9ff')),
RoughRect(201,1,100,100),
RoughRect(301,1,100,100),
RoughRect(1,101,100,100),
RoughRect(101,101,100,100),
RoughRect(201,101,100,100),
RoughRect(301,101,100,100),
RoughRect(1,201,100,100),
RoughRect(101,201,100,100),
RoughRect(201,201,100,100),
RoughRect(301,201,100,100),
RoughRect(1,301,100,100),
RoughRect(101,301,100,100),
RoughRect(201,301,100,100),
RoughRect(301,301,100,100)
)
)
)
output$cy = renderShinyCyJS( shinyCyJS(buildNode('a')) )
}
shinyApp(ui, server)
shinyRoughJS(list(
list(type="rectangle", x = 5,y = 5, w = 30, h = 30,
#options = list(roughness = 0.5, fill = 'red')
options = RoughOptions()
)
))
shinyRoughJS(list(
RoughRect(1,1,25,25),
RoughRect(26,26,25,25, RoughOptions(fill = 'red', stroke = 'black')),
RoughRect(51,51,25,25, RoughOptions(fill = 'green', stroke = 'black')),
RoughCircle(0,0,1),
RoughCircle(100,100,1)
)) # work
shinyRoughJS(items = c(list( RoughRect(5,5,30,30)),list( RoughRect(40,40,30,30)))) # work
shinyRoughJS(items = c(RoughRect(5,5,30,30),RoughRect(40,40,30,30))) # not work
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.