Description Usage Arguments Proxies Examples
Use proxies with shiny.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | b_zoom_p(proxy, domain)
b_focus_p(proxy, series)
b_defocus_p(proxy, series = NULL)
b_transform_p(proxy, to, serie)
b_stack_p(proxy, serie)
b_region_p(proxy, axis, start, end, class = NULL)
b_add_region_p(proxy, axis, start, end, class = NULL)
b_flow_p(proxy, data, series, x = NULL)
b_load_p(proxy, data, series, unload = NULL)
b_export_p(proxy)
|
proxy |
an object of class |
domain |
domain to zoom to. |
to |
transformation target, see details. |
serie, series |
target series. |
axis |
target axis. |
start, end |
start and end of region. |
class |
|
data |
data set. |
x |
x column. |
unload |
series to unload. |
Zoom on a specific area.
Focus on a particular serie.
Unfocus from particular serie.
Change charge type.
Stack series.
Add regions.
Define region.
Add rows of data.
Add series.
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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | ## Not run:
library(shiny)
ui <- fluidPage(
fluidRow(
column(
3,
sliderInput("zoom",
"Zoom on a region",
min = 0,
max = 150,
value = 100
)
),
column(
2,
selectInput(
"transform",
"Filter:",
choices = c("line", "spline", "area", "area-spline", "scatter", "bar"),
selected = "line"
)
),
column(
2,
selectInput(
"focus",
label = "Focus on data",
choices = c("y", "z"),
selected = "y"
)
),
column(
3,
selectInput(
"stack",
label = "Stack",
choices = c("x", "y", "z"),
selected = "y",
multiple = TRUE
)
),
column(
2,
checkboxInput(
"region", "Add region", FALSE
)
)
),
fluidRow(
billboardOutput("billboard")
),
fluidRow(
column(
3,
sliderInput("add",
"Add rows",
min = 0,
max = 100,
value = 0
)
),
column(
3,
actionButton("cols", "Add serie")
),
column(
3,
actionButton("export", "Export")
)
)
)
server <- function(input, output){
data <- data.frame(x = runif(100, 1, 100),
y = runif(100, 1, 100),
z = runif(100, 1, 100))
df <- eventReactive(input$add, {
data.frame(x = runif(input$add, 10, 80),
y = runif(input$add, 10, 80),
z = runif(input$add, 10, 80))
})
random_data <- eventReactive(input$cols, {
df <- data.frame(x = runif(100, 1, 100))
names(df) <- paste0("col", sample(LETTERS, 1))
df
})
output$billboard <- renderBillboard({
data %>%
b_board() %>%
b_line(x) %>%
b_bar(y, stack = TRUE) %>%
b_area(z, stack = TRUE) %>%
b_zoom()
})
observeEvent(input$zoom, {
billboardProxy("billboard") %>%
b_zoom_p(c(0, input$zoom))
})
observeEvent(input$transform, {
billboardProxy("billboard") %>%
b_transform_p(input$transform, "x")
})
observeEvent(input$focus, {
billboardProxy("billboard") %>%
b_focus_p(list("x", input$filter))
})
observeEvent(input$stack, {
billboardProxy("billboard") %>%
b_stack_p(list("x", input$stack))
})
observeEvent(input$region, {
if(isTRUE(input$region)){
billboardProxy("billboard") %>%
b_add_region_p(axis = "x", start = 1, end = 40)
}
})
observeEvent(input$add, {
billboardProxy("billboard") %>%
b_flow_p(df(), names(df()))
})
observeEvent(input$cols, {
billboardProxy("billboard") %>%
b_load_p(random_data(), names(random_data()))
})
observeEvent(input$export, {
billboardProxy("billboard") %>%
b_export_p()
})
}
shinyApp(ui, server)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.