2018-09-09 22:09:05 +02:00
|
|
|
|
|
|
|
# ------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Title : Update serie
|
|
|
|
# By : Victor
|
|
|
|
# Date : 2018-09-09
|
|
|
|
#
|
|
|
|
# ------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
library(shiny)
|
|
|
|
library(apexcharter)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ui <- fluidPage(
|
|
|
|
tags$h2("Radomly update serie"),
|
|
|
|
apexchartOutput(outputId = "graph", width = "600px"),
|
|
|
|
actionButton(inputId = "update", label = "Update data")
|
|
|
|
)
|
|
|
|
|
|
|
|
server <- function(input, output, session) {
|
|
|
|
|
|
|
|
output$graph <- renderApexchart({
|
2019-02-15 22:33:14 +01:00
|
|
|
apexchart() %>%
|
2018-09-09 22:09:05 +02:00
|
|
|
ax_chart(type = "line") %>%
|
|
|
|
ax_plotOptions(line = list(curve = "smooth")) %>%
|
|
|
|
ax_dataLabels(enabled = FALSE) %>%
|
|
|
|
ax_series(
|
|
|
|
list(
|
|
|
|
name = "rnorm",
|
|
|
|
data = round(rnorm(20), 3)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
})
|
|
|
|
|
|
|
|
observeEvent(input$update, {
|
|
|
|
apexchartProxy(shinyId = "graph") %>%
|
|
|
|
ax_proxy_series(newSeries = list(data = round(rnorm(20), 3)))
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
shinyApp(ui, server)
|
|
|
|
|
|
|
|
|