Description Usage Arguments Value Examples
View source: R/fabric_shape_add.R
Add a shape object to a preexisting canvas element
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
cid |
the id of the canvas element you want to add your shape to |
shapeId |
the id of the shape object |
shape |
the shape of the object. Choices include 'Circle', 'Triangle' and 'Rect'. Defaults to 'Rect' |
left |
the shape's position from the left relative to the canvas element. Defaults to 100 |
top |
the shape's position from the top relative to the canvas element. Defaults to 100 |
fill |
the color of the shape. Defaults to 'red' |
width |
the width of the shape. Defaults to 200 |
height |
the height of the shape. Defaults to 200 |
angle |
the angle of rotation of the shape. Defaults to 0 (no rotation) |
opacity |
the opacity of the shape. Defaults to 1 |
strokecolor |
the stroke color of the shape. Defaults to 'darkblue' |
strokewidth |
the stroke width of the shape. Defaults to 5. |
selectable |
logical. If TRUE, the user can modify interactively the shape. Defaults to TRUE |
radius |
Mandatory if the chosen shape is a 'Circle'. Defaults to NULL |
xPolygon |
a vector of the coordinate points of the polygon, from the left. |
yPolygon |
a vector of the coordinate points of the polygon, from the top |
a shape object inside a preexisting canvas element
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | if (interactive()) {
ui <- fluidPage(
fabric_shape(cid = "canvas",
shapeId = "shape1",
shape = "Rect",
left = 130,
top = 200),
fabric_shape_add(cid = "canvas",
shapeId = "shapo",
shape = "Circle",
radius = 30,
left = 100,
top = 100),
fabric_shape_add(cid = "canvas",
shapeId = "shapa",
shape = "Circle",
radius = 30,
left = 200,
top = 100),
fabric_shape_add(cid = "canvas",
shapeId = "shapox",
shape = "Circle",
radius = 30,
left = 300,
top = 100),
fabric_shape_add(cid = "canvas",
shapeId = "shapor",
shape = "Circle",
radius = 30,
left = 300,
top = 100)
)
server <- function(input, output) {}
shinyApp(ui = ui, server = server)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.