-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.R
54 lines (49 loc) · 1.04 KB
/
test.R
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
devtools::load_all()
library(shiny)
library(echarts4r)
ui <- fluidPage(
theme = bslib::bs_theme(5L),
actionButton("render", "Render"),
div(
class = "row",
div(
class = "col-md-6",
litecharts4rOutput("lite")
),
div(
class = "col-md-6",
echarts4rOutput("ec")
)
)
)
server <- function(input, output, session){
output$lite <- renderLitecharts4r({
input$render
litecharts4r() |>
set_title(title = "Hello world!") |>
set_x_axis(data = letters[1:20]) |>
set_y_axis() |>
add_serie(
name = "serie 1",
type = sample(c("line", "scatter"), 1),
data = runif(20)
) |>
add_serie(
name = "serie 2",
type = sample(c("line", "scatter"), 1),
data = runif(20)
)
})
output$ec <- renderEcharts4r({
input$render
data.frame(
x = 1:10,
y1 = runif(10),
y2 = runif(10)
) |>
e_charts(x = x) |>
e_line(y1) |>
e_scatter(y2)
})
}
shinyApp(ui, server, options = list(port = 3000L))